-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Update system status info about WC Admin. #25830
Conversation
The check now also tests whether wc admin is active to prevent notice about undefined constant when running on WP 5.2 and older, or with inactive WC Admin.
cc @rrennick to check the logic for WC Admin. |
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.
Looks good to me and I could confirm that it fixes the warning message. I left a comment with a nitpick suggestion.
Besides that, related to the part of the code that is changed in this PR but not directly related to this PR, I found a bit confusing that when WooCommerce Admin is inactive we show the string "Inactive" together with the version number and package path in green. It took me a while to realize what was the difference between when the plugin is inactive or active. I imagine that changing the font color to red is too drastic, but maybe we could change it to black and display a X when the plugin is inactive? That is what we do, for example, when there is no child theme installed. I'm not sure if we want to address this in this release cycle.
$path = \Automattic\WooCommerce\Admin\Composer\Package::get_path(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited | ||
} elseif ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) { | ||
// To prevent $path from previous package to leak into the conditions in this section. | ||
$path = null; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
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.
Just a nitpick, but what if instead of using this generic name $path
, we use a more specific name like $wc_admin_path
. This way, we don't need to worry about other places that are using the same variable name, and also, we don't need to add a phpcs:ignore
comment whenever we use this variable.
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.
Agreed, wanted to do that already, but then wasn't sure if I should rename the vars in other sections. Let's update at least this one.
@peterfabian Looks good. |
I was wondering about changing it, but haven't noticed we have this neutral option available. Updated to the below in a9e262c: |
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.
Thanks for the changes.
The check now also tests whether wc admin is active to prevent notice about undefined constant when running on WP 5.2 and older, or with inactive WC Admin.
All Submissions:
Changes proposed in this Pull Request:
Closes # .
How to test the changes in this Pull Request:
Get a testing machine with WP 5.2
Install WC 4.0-rc.1
Go to system status and observe the error
apply this branch
check again, it should show the WC Admin is inactive:
Update to WP 5.3
Check that WC Admin becomes active:
Try installing & activating the WC Admin plugin, check that the version and path are correctly pointing to the plugin:
Deactivate the plugin, it should, again, show the included package info.
Use a snippet to deactivate WC Admin package (
add_filter( 'woocommerce_admin_disabled', '__return_true' );
to wc-core-functions.php)It should show Inactive package in the system status report.
Other information:
Changelog entry