Plugin Checker Deactivation Causes Error in CLI Command #236
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.
During QA testing, it was discovered that if the Plugin Checker is deactivated and the CLI command
npm run wp-env run cli -- wp plugin check {plugin} --require=./wp-content/plugins/plugin-check/cli.php
is executed, it shows an error. The error is related to the behaviour discussed in the following comment on GitHub: #194 (comment). As a result of this finding, the decision was made to throw an error when anyone attempts to use the CLI command while the Plugin Checker is not activated.Proposed Solution:
To address the issue, the possible code changes need to be added to the
cli.php
file. However, due to thecli.php
file running early in WordPress, certain functions cannot be used there. As a workaround, the necessary code has been added to theincludes/CLI/Plugin_Check_Command.php
file.Steps to Reproduce:
Admin Panel > Plugins
.{plugin}
with the slug of the plugin you want to check.Expected behaviour:
After applying the changes from the pull request, the CLI command should display the error message:
Error: plugin-check/plugin-check.php is not active.
when attempting to use it while the Plugin Checker is not activated.Checklist: