-
Notifications
You must be signed in to change notification settings - Fork 219
Improve caching plugin_dir_url() in Package. #6260
Conversation
Size Change: 0 B Total Size: 863 kB ℹ️ View Unchanged
|
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 is looking good, thank you @shendy-a8c I will look into why tests are failing.
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 was able to break my local site and this patch fixed it.
e480945
to
09f4370
Compare
* Call plugin_dir_url() in Package::get_url() instead of from its constructor. (#6260) * Empty commit for release pull request * add readme * Bumping version strings to new version. * add testing steps Co-authored-by: Shendy <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: Nadir Seghir <[email protected]>
4946323-zen Just adding this ticket to the correct issue now. Thanks for working on fixing this. |
Adding a report from a user here: 4945466-zd WooCommerce sidebar not showing up when either "WooCommerce Points and Rewards" or "WooCommerce Subscriptions" are active. |
I added this to the wrong issue earlier but I have a site where the WooCommerce menu is not showing in the wp-admin pages when WooCommerce Subscriptions plugin is activated. 35150771-hc |
Another: 4948744-zen |
One more: 35164303-hc |
Another instance here: 4947306-zen |
Another one #4946963-zen |
This is still affecting this site: 4947647-zd-woothemes |
A fix will go out with WooCommerce 6.4.1. A workaround currently is to install WooCommerce Blocks 7.4.1 or downgrade WooCommerce to 6.3.1 |
Do you have an ETA on when WooCommerce 6.4.1 will be released? (my issue is ticket number 4948744) |
Hey @mvcarlton ! I don't no, as I'm not the one doing the release and I'm not sure how much will it take. Expect it today or tomorrow at max. |
@senadir thank you! I will keep an eye out! |
* Empty commit for release pull request * Call plugin_dir_url() in Package::get_url() instead of from its constructor. (#6260) * add readme changelog * add testing steps * Bumping version strings to new version. Co-authored-by: github-actions <[email protected]> Co-authored-by: Shendy <[email protected]> Co-authored-by: Nadir Seghir <[email protected]>
A problem observed in Atomic Site with WC 6.4.0 and WooCommerce Subscription installed.
wp-admin > WooCommerce > Home page is blank because
wc-settings.js
URL returns 404.It should be
/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-settings.js
, instead,/wp-content/plugins/wordpress/plugins/woocommerce/6.4.0/packages/woocommerce-blocks/build/wc-settings.js
is loaded.Missing
wc-settings.js
causes uncaught error.After some investigation, this problem happens when
wp-content/plugins/woocommerce
is a symlink (like how Pressable, Atomic Site, and wp.com manages WooCommerce for sites they create) and attempt to cache the return value ofplugin_dir_url()
from #5915 makes all this possible.Calling plugin_dir_url() in Package’s constructor gives different result vs calling it from get_url().
plugin_dir_url() eventually calls plugins_url() which eventually calls plugin_basename().
plugin_basename() depends on the value of a global variable $wp_plugin_paths.
When called in Package’s constructor, woocommerce’s path isn’t yet part of $wp_plugin_paths, so it doesn’t return the basename correctly.
Testing
Automated Tests
Manual Testing
How to test the changes in this Pull Request:
Install WooCommerce Subscriptions.
Try to open wp-admin > WooCommerce > Home (/wp-admin/admin.php?page=wc-admin). With base branch, expect a blank page. With this PR branch, expect page loads normally.
I didn't try loading blocks as an independent plugin, only when it's within WooCommerce.
User Facing Testing
These are steps for user testing (where "user" is someone interacting with this change that is not editing any code).
Performance Impact
This change should have the same optimization as #5915.
Changelog