Skip to content

Plugin Checker Deactivation Causes Error in CLI Command #236

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

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

mukeshpanchal27
Copy link
Member

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 the cli.php file running early in WordPress, certain functions cannot be used there. As a workaround, the necessary code has been added to the includes/CLI/Plugin_Check_Command.php file.

Steps to Reproduce:

  1. Install any plugin that you want to check.
  2. Deactivate the "Plugin Checker" from Admin Panel > Plugins.
  3. Execute the following CLI command:
    npm run wp-env run cli -- wp plugin check {plugin} --require=./wp-content/plugins/plugin-check/cli.php
    
    Replace {plugin} with the slug of the plugin you want to check.
  4. Observe the error that occurs.

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:

@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review July 25, 2023 10:35
@mukeshpanchal27 mukeshpanchal27 mentioned this pull request Jul 25, 2023
1 task
Copy link
Member

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

Reminds me to look into #153 soon

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mukeshpanchal27, LGTM, would be great if you could incorporate @swissspidy's suggestion.

@mukeshpanchal27
Copy link
Member Author

Thank you, @swissspidy, for the suggestion. We will definitely take a look at item 153 as soon as possible. Your input is appreciated!

@mukeshpanchal27 mukeshpanchal27 merged commit 0033f5b into trunk Jul 26, 2023
@mukeshpanchal27 mukeshpanchal27 deleted the fix/cli-command-issue branch July 26, 2023 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants