-
Notifications
You must be signed in to change notification settings - Fork 384
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
Restrict doing plugin upgrade routine when not in admin #4538
Conversation
Before doing this, we'll need to audit what will happen if a new version of the plugin runs with an old DB version, as the upgrade routine will now not run unconditionally anymore and it might be hours, days or weeks between updating the plugin files and updating the DB. This can lead to unexpected behavior and breakage if the new code doesn't expect the old DB schema. |
@schlessera There are only two instances of the amp-wp/includes/validation/class-amp-validated-url-post-type.php Lines 147 to 173 in cfd87a2
amp-wp/src/BackgroundTask/MonitorCssTransientCaching.php Lines 158 to 168 in cfd87a2
I don't see how either of these will cause problems if they are deferred to when the admin user logs in. For the first, it's only for sites running the AMP plugin on versions before 1.0 stable. And it is just renaming a post type for the validated URLs. There's no impact on that being deferred. For the second, it's just making sure the transient caching gets re-enabled when upgrading from 1.5.0+ to 1.5.2. This also can wait until the admin user logs in. So in both cases I see no issue to move forward. |
Looks good then. We just need to keep this in mind when we use this hook. It changes from enforcing consistency after upgrades to hopefully end up with eventual consistency instead. So we cannot rely on anything that happens during an update event, it will either need to be optional or trigger user feedback in some way. |
* 'develop' of github.com:ampproject/amp-wp: Update tests after block-library/style.css changes in Gutenberg 7.9 (ampproject#4579) Restrict doing plugin upgrade routine when not in admin (ampproject#4538)
Verified in QA. The upgrade routine is only run when an admin logs in that has the permission of managing options. |
* 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
Summary
The changes here in effect restrict the upgrade routine to happen at
admin_init
. This was discussed in depth at #4177. This implements #3284 (comment):Fixes #3284
Checklist