Add multisite network checks for site count, network options, and required plugins#208
Add multisite network checks for site count, network options, and required plugins#208deshabhishek007 wants to merge 3 commits intowp-cli:mainfrom
Conversation
|
Hello! 👋 Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project. Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. Here are some useful Composer commands to get you started:
To run a single Behat test, you can use the following command: # Run all tests in a single file
composer behat features/some-feature.feature
# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123You can find a list of all available Behat steps in our handbook. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces three useful checks for WordPress multisite installations: Network_Site_Count, Network_Site_Option_Value, and Network_Required_Plugins. The implementation is solid and includes good test coverage with Behat features. I have a few suggestions for improvement. In Network_Required_Plugins, I've recommended refactoring to use WordPress internal functions instead of WP_CLI::run_command for better performance. In Network_Site_Count, I've suggested a small refactoring to improve code clarity and consistency by casting properties in the constructor. The other changes, including the PHP 8.1 compatibility fix in Command.php, look good.
There was a problem hiding this comment.
Pull request overview
Adds new multisite-focused wp doctor checks (with Behat coverage) to help diagnose common network-level configuration and compliance issues, plus a small PHP-version compatibility tweak in the doctor list reflection flow.
Changes:
- Added multisite checks for network site count thresholds, network option value validation, and required network-activated plugins.
- Added Behat feature coverage for each new multisite check.
- Guarded
ReflectionProperty::setAccessible(true)usage indoctor listfor PHP version compatibility.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Command.php | Adjusts reflection accessibility handling for doctor list token replacement across PHP versions. |
| src/Check/Network_Site_Count.php | New check to warn when site count is outside configurable min/max thresholds. |
| src/Check/Network_Site_Option_Value.php | New check to validate get_site_option() against expected / not-expected values. |
| src/Check/Network_Required_Plugins.php | New check to ensure specified plugins are installed and network-activated. |
| features/check-network-site-count.feature | Behat coverage for the new network site count check. |
| features/check-network-site-option-value.feature | Behat coverage for the new network option value check. |
| features/check-network-required-plugins.feature | Behat coverage for the new required network plugins check. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
This PR adds three multisite-focused doctor checks with Behat coverage:
Network_Site_CountChecks network site count against configurable
minimum/maximumthresholds.Network_Site_Option_ValueValidates network-level options via
get_site_option()usingvalueorvalue_is_not.Network_Required_PluginsEnsures required plugins are installed and network-activated (
active-network).Why
wp doctorhad limited network-specific diagnostics. These checks add practical multisite health/compliance coverage for common ops requirements.Changes
src/Check/Network_Site_Count.phpsrc/Check/Network_Site_Option_Value.phpsrc/Check/Network_Required_Plugins.phpfeatures/check-network-site-count.featurefeatures/check-network-site-option-value.featurefeatures/check-network-required-plugins.featuresrc/Command.php(ReflectionProperty::setAccessible()guarded for< PHP 8.1)Behavior Notes
Network_Site_Option_Valueerrors if bothvalueandvalue_is_notare set.Network_Required_Pluginsreports missing and non-network-activated plugins with details.Testing
composer phpcsWP_CLI_TEST_DBTYPE=sqlite composer testfeatures/check-network-site-count.featurefeatures/check-network-site-option-value.featurefeatures/check-network-required-plugins.featureAll passing locally.