-
Notifications
You must be signed in to change notification settings - Fork 62
Feature/Debug Enhancement #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
khleomix
wants to merge
16
commits into
main
Choose a base branch
from
feature/debug-enhancement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ee8ce43
Add debug page with details and algolia specific logs
khleomix ce9ea98
Set Algolia reindex to gentle mode: batch size 10, 5s delay
khleomix 63ed7d3
Minor update to version
khleomix 00d9dd9
Fix linter errors
khleomix bd1c4a0
Fix linter errors
khleomix c7076b9
Additional linter fixes
khleomix 311d38a
Use wp_send_json_error for consistent AJAX error handling in Algolia …
khleomix 6b0d830
Add environment and debug mode info to Algolia Debug page
khleomix 492e8f1
Re-add removed functions during testing and update batch size to 50 w…
khleomix 9aad3c7
Show Debug submenu under Algolia Search in network admin
khleomix af5b674
Enhance debug admin: show Application ID, Search API Key, and environ…
khleomix 259481c
Fix linter errors
khleomix db615e4
Revert abstract method get_items to match main and updated batch size…
khleomix a15bf36
Change label from VIP to WPVIP
khleomix 6cac460
Show only enabled indices in debug page and remove Enabled column
khleomix 025f168
Fix linter issue
khleomix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| <?php | ||
| /** | ||
| * Algolia_Admin_Page_Debug class file. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * @package WebDevStudios\WPSWA | ||
| */ | ||
|
|
||
| /** | ||
| * Algolia_Admin_Page_Debug class. | ||
| * | ||
| * @since 2.10.1 | ||
| */ | ||
| class Algolia_Admin_Page_Debug { | ||
|
|
||
| /** | ||
| * Admin page slug. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * | ||
| * @var string | ||
| */ | ||
| private $slug = 'algolia-debug'; | ||
|
|
||
| /** | ||
| * Admin page capabilities. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * | ||
| * @var string | ||
| */ | ||
| private $capability = 'manage_options'; | ||
|
|
||
| /** | ||
| * Admin page section. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * | ||
| * @var string | ||
| */ | ||
| private $section = 'algolia_section_debug'; | ||
|
|
||
| /** | ||
| * Admin page option group. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * | ||
| * @var string | ||
| */ | ||
| private $option_group = 'algolia_settings'; | ||
|
|
||
| /** | ||
| * Plugin instance. | ||
| * | ||
| * @author WebDevStudios <[email protected]> | ||
| * @since 2.10.1 | ||
| * | ||
| * @var Algolia_Plugin | ||
| */ | ||
| private $plugin; | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param Algolia_Plugin $plugin The plugin instance. | ||
| */ | ||
| public function __construct( Algolia_Plugin $plugin ) { | ||
| $this->plugin = $plugin; | ||
|
|
||
| add_action( 'admin_menu', [ $this, 'add_page' ] ); | ||
| add_action( 'network_admin_menu', [ $this, 'add_network_page' ] ); | ||
| add_action( 'admin_init', [ $this, 'add_settings' ] ); | ||
| } | ||
|
|
||
| /** | ||
| * Add the page to the admin menu (single site). | ||
| */ | ||
| public function add_page() { | ||
| add_submenu_page( | ||
| 'algolia', | ||
| esc_html__( 'Debug', 'wp-search-with-algolia' ), | ||
| esc_html__( 'Debug', 'wp-search-with-algolia' ), | ||
| $this->capability, | ||
| $this->slug, | ||
| [ $this, 'display_page' ] | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Add the page to the network admin menu (multisite). | ||
| */ | ||
| public function add_network_page() { | ||
| add_submenu_page( | ||
| 'wpswa_pro_network', | ||
| esc_html__( 'Debug', 'wp-search-with-algolia' ), | ||
| esc_html__( 'Debug', 'wp-search-with-algolia' ), | ||
| 'manage_network_options', | ||
| $this->slug, | ||
| [ $this, 'display_page' ] | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Add the settings section. | ||
| */ | ||
| public function add_settings() { | ||
| add_settings_section( | ||
| $this->section, | ||
| null, | ||
| [ $this, 'print_section_settings' ], | ||
| $this->slug | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Display the page. | ||
| */ | ||
| public function display_page() { | ||
| require_once dirname( __FILE__ ) . '/partials/form-options-debug.php'; | ||
| } | ||
|
|
||
| /** | ||
| * Print the section settings. | ||
| */ | ||
| public function print_section_settings() { | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has me going "hmm" because from a plugin standpoint, should free/"base" plugins be intentionally aware of addons that extend it? or should they be "dumb" but built in ways that allow for extending unbeknownst to it's own code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tw2113 The current setup is intentionally “dumb” in the best-practice sense—it doesn’t have any logic that’s aware of addons. It just registers its own admin pages and handles its own debug view.
Long-term, the idea is to keep the base plugin clean and maintainable, while making it easy to extend via hooks or filters. So yeah, it’s not trying to be smart—just flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to assume it'd just silently fail, but the reference to
wpswa_pro_networkis the spot where we're "smartening it up" with one line of code.