Add button into Site Health to reenable CSS transient caching#4522
Add button into Site Health to reenable CSS transient caching#4522westonruter merged 30 commits intodevelopfrom
Conversation
|
However, there's currently a problem with the @westonruter Are there any requirements to using the |
Perhaps the WP nonce is not being sent along with the request? |
|
The code does execute the call to the |
Co-Authored-By: Weston Ruter <westonruter@google.com>
|
Figured it out. The |
|
Tests failed for unrelated timeout in E2E tests: |
@schlessera these tests are failing because of an error being thrown (see #4522 (comment)). |
|
I think this button could be highlighted a little better, given how deep it's hidden in Site Health. I don't see how the user would know about it unless they've been told where it is. |
I assumed for now that this is mainly for the support team to be able to point them to some place to reset the cache instead of handing them a snippet filter or a custom filter to do so. I don't think this should be a standard user operation. But I'm happy to change this if my assumption is incorrect. @westonruter @amedina Thoughts? |
Co-Authored-By: Weston Ruter <westonruter@google.com>
…aching-reenable-button * 'develop' of github.com:ampproject/amp-wp: Restore unification of multi-page post content in Reader mode (#4547) Prevent styles from being removed when in Customizer preview with Standard mode (#4553) Omit Jetpack from being activated during PHPUnit test runs Use title case for Paired Browsing link in edit post screen (#4540) Ensure that validation query vars persist through redirects (#4544) Update dependency babel-jest to v25.2.6 (#4510) Update dependency css-loader to v3.5.0 (#4537) Update dependency autoprefixer to v9.7.6 (#4539) Add requirements to plugin file header (#4543) Force status code of validation responses to be 200 (#4533) Update optimizer test specs (#4527) Bump stable tag to 1.5.2 Cache response status and headers when fetching external stylesheets (#4509) Fix securing multi-line mustache templates (#4521) Add CSS monitoring time series to Site Health debugging info (#4519) Update hostname used for WordPress TV embeds to fix external HTTP requests (#4524) Mock Imgur embed tests Mock Facebook embed tests Standardize file and class names for embed handlers
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
* Add button into Site Health to reenable CSS transient caching * Use wp_jsonencode() instead of addslashes() Co-Authored-By: Weston Ruter <westonruter@google.com> * Remove unneeded PHPCS exception * Use wp.ajax and heredoc for JS script * Update styling * Add capability check * Use current_user_can() * Add CSS transient caching option to options manager validation * Fix code style issues * Only read Option::DISABLE_CSS_TRANSIENT_CACHING if exists * Remove <script> tags from JS code passed to wp_add_inline_script() * Remove pesky 2nd blank line Co-Authored-By: Weston Ruter <westonruter@google.com> * Rename AjaxAction to ReenableCssTransientCachingAjaxAction * Remove $access and default to authenticated users only * Remove $scope and default to admin backend only * Remove $action and hardcode as const * Remove $callback and move method into AjaxAction * Remove $selector and hardcode as const * Only register AJAX action on site-health.php screen * Use tabs instead of spaces to indent CSS * Escape button label translations * Add nonce verification * Disable button after click * Use DOMContentLoaded instead of a timeout * Indent JS code with tabs instead of spaces * Document $hook_suffix argument * Flesh out guidance for CSS transient caching * Avoid string interpolation for JS injection to better ensure late-escaping * Use nowdoc instead of heredoc Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com> Co-authored-by: Weston Ruter <westonruter@google.com>
|
Looks good Hi @amedina, After forcing the option to be AMP_Options_Manager::update_option( 'amp_css_transient_monitor_disable_caching', true );...the test appeared in Site Health: |
* tag '1.5.3': Bump 1.5.3 Bump version to 1.5.3-RC1 Fix handling of Mustache templates (#4583) Stub request based on test scenario (#4588) Update tests after block-library/style.css changes in Gutenberg 7.9 (#4579) Restrict doing plugin upgrade routine when not in admin (#4538) Add new accessibility sanitizer (#4535) Fix unit tests (#4564) Add button into Site Health to reenable CSS transient caching (#4522) Restore unification of multi-page post content in Reader mode (#4547) Prevent styles from being removed when in Customizer preview with Standard mode (#4553) Omit Jetpack from being activated during PHPUnit test runs (#4474) Mock Facebook embed tests (#4474) Mock Imgur embed tests (#4474) Use title case for Paired Browsing link in edit post screen (#4540) Ensure that validation query vars persist through redirects (#4544) Add requirements to plugin file header (#4543) Force status code of validation responses to be 200 (#4533) Update optimizer test specs (#4527) Bump 1.5.3-alpha






Add CSS monitoring time series to Site Health debugging info
Summary
This PR adds a button to the Site Health AMP panel to reenable CSS transient caching when it was disabled.
Button:

Button when the AJAX request failed:

Button when the AJAX request succeeded:

Fixes #4523
Checklist