Prefix cache names for PHP-registered caching strategies#147
Merged
westonruter merged 5 commits intomasterfrom Apr 10, 2019
Merged
Prefix cache names for PHP-registered caching strategies#147westonruter merged 5 commits intomasterfrom
westonruter merged 5 commits intomasterfrom
Conversation
westonruter
commented
Apr 2, 2019
| $script .= sprintf( "workbox.core.setCacheNameDetails( %s );\n", wp_service_worker_json_encode( $cache_name_details ) ); | ||
|
|
||
| // Export the prefix as a constant since it is not accessible via workbox.core.cacheNames, unfortunately (yet). | ||
| $script .= sprintf( 'const WP_SERVICE_WORKER_CACHE_PREFIX = %s;', wp_service_worker_json_encode( $prefix ) ); |
Collaborator
Author
There was a problem hiding this comment.
See GoogleChrome/workbox#1998 for an enhancement to Workbox to allow accessing the cache prefix.
Collaborator
Author
There was a problem hiding this comment.
And see fix in GoogleChrome/workbox#2001 which we can take advantage of once the next version of Workbox is released.
Collaborator
Author
There was a problem hiding this comment.
If we merge #150 first then we can avoid adding this const.
Collaborator
Author
There was a problem hiding this comment.
As Workbox 4.2.0 has been released with the prefix getter.
felixarntz
reviewed
Apr 3, 2019
Collaborator
felixarntz
left a comment
There was a problem hiding this comment.
LGTM! One question in a separate comment - if that's not the case, then consider this approved already.
westonruter
added a commit
to ampproject/amp-wp
that referenced
this pull request
Apr 3, 2019
…es-redux * 'develop' of github.com:ampproject/amp-wp: (31 commits) Add tests for AMP integration with PWA plugin Ensure is_amp_endpoint() returns false for service worker requests Account for element attributes when determining if a parent is empty and can be removed Fix tests after always including Gutenberg Add check for argument type in add_google_fonts_caching; advise to update to PWA 0.2 Align default-enabled service worker features with ABE SW Remove todo resolved by GoogleChromeLabs/pwa-wp#147 Make AMP service worker opt-out instead of opt-in Add tests for amp-twitter in STAMP layer and changes to amp-brid-player Update allowed tags/attributes from spec in amphtml 1903262220080 Use proper URL for content in image caching Gate AMP service worker functionality behind theme support flag Add updated Google Fonts runtime caching particularly if PWA integration not enabled Unpluralize AMP_Service_Workers; sync changes from #1519 Add comments with links to amp-by-example code Update runtime pre-caching based on GoogleChromeLabs/pwa-wp#61 Apply changes for GoogleChromeLabs/pwa-wp#59 Limit runtime images cache to URLs in wp-content Allow query params on URLs for cached images Improve passing of registry object to register_runtime_precaches method ...
westonruter
added a commit
to ampproject/amp-wp
that referenced
this pull request
Apr 5, 2019
…r-mode * 'develop' of github.com:ampproject/amp-wp: (50 commits) Fix printing of PHP upgrade notice Fix PHP notice for undefined theme support arg for service_worker Remove admin pointer tests that fail in 1.1 Discontinue showing theme support admin pointer in 1.1 Add tests for AMP integration with PWA plugin Ensure is_amp_endpoint() returns false for service worker requests Account for element attributes when determining if a parent is empty and can be removed Fix tests after always including Gutenberg Add check for argument type in add_google_fonts_caching; advise to update to PWA 0.2 Align default-enabled service worker features with ABE SW Remove todo resolved by GoogleChromeLabs/pwa-wp#147 Make AMP service worker opt-out instead of opt-in Opt-in to amp-img-auto-sizes experiment when there are converted images Remove obsolete add_auto_width_to_figure from #1086 Add test for sizes attribute being removed from converted img Improve aligncenter, alignwide, and alignfull in classic templates Rename method to adjust_twentynineteen_images Eliminate sizes from amp-img converted from img Ensure featured image gets responsive layout in Twenty Nineteen, as it is essentially alignwide Give responsive layout to alignwide/alignfull instead of intrinsic layout ...
felixarntz
approved these changes
Apr 8, 2019
Collaborator
Author
|
Depends on merging #150 which will allow this PR to improve how it gets the prefix. |
…-route-cache-names * 'master' of github.com:xwp/pwa-wp: (22 commits) Bump minimum required WordPress to 5.1 and tested WordPress to 5.2. Update description of adding service worker theme support. Install xmllint for Trusty Add composer install during Travis build Update Node to 8.15.1 Eliminate use of precise Bump Requires PHP to 5.6 Add PROJECT_SLUG=pwa for dev-lib Remove dead code for PHP 5.2 Install wp-dev-lib via composer instead of npm Run build during Travis install; remove PHP<5.6; add PHP 7.3 Upgrade workbox to 4.2.0 Bump required PHP version to 5.6 Add admin notice for when installing from source Eliminate composer install from npm install Remove obsolete workbox-upgrade script Add install_workbox Grunt command and run as part of build Remove workbox files from being version controlled Add typehint for WP_Service_Worker_Scripts class. Allow granular enabling of service worker integrations, load integration classes only as they are needed. ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prevent collisions in caches for subdirectory installs.
Fixes #146.
Before:
After: