Comments (5)
Yikes, you're right! Thanks for reporting, @mslinnea.
Originally added here by @mikeyarce before the class got moved to it's own file.
Code is now here.
from wpcom-legacy-redirector.
We fixed this performance issue by adding this to theme code:
remove_action( 'init', [ 'WPCOM_Legacy_Redirector', 'register_redirect_custom_capability' ] );
As for fixing this in the plugin, I think this should only run during plugin activation or during a plugin upgrade routine. It's important to make sure this only runs in a limited and controlled manner.
from wpcom-legacy-redirector.
When plugins are activated by code on VIP, there is no plugin activation or upgrade routine.
But, we should be able to protect against by using the approach at https://docs.wpvip.com/how-tos/customize-user-roles/.
from wpcom-legacy-redirector.
We experienced an issue with the customize-user-roles code suggestion. The issue is that when the version is changed, all page requests will attempt to update the option at the same time. On a site with a lot of traffic, this caused a brief site outage as the database experienced an overload. We moved this update option code to a CLI command so that it only runs once. Alternatively, it could be limited to running only in the admin, which most likely wouldn't create enough requests to overload the database.
from wpcom-legacy-redirector.
@mslinnea Please see #94 - the hook is now admin_init
, the capability registration incorporates a version check, and we've added some unit tests to have more confidence that everything is working.
from wpcom-legacy-redirector.
Related Issues (20)
- Introduce Redirect_Code class
- Stop post type being indexed by VIP Search
- Migrate plugin documentation to repo
- Add redirects individually does not work HOT 2
- CLI: insert-redirect fails when using post ID
- UI: duplicate redirects when using slug and ID HOT 3
- Remove support for bulk editing HOT 1
- Decouple validation logic HOT 1
- Add validate-csv command
- Can't add redirect when using a self-signed certificate
- Switch from custom edit page, to meta boxes on an Add New page
- Improve Documentation for class-wpcom-legacy-redirector.php HOT 1
- Utilize Constant for Plugin Slug HOT 3
- UI: Relative paths in network subsites misleading previews and bypassed validation HOT 1
- Submit to packagist HOT 1
- Tag a new release for the latest stable version of the plugin HOT 1
- Handling AMP redirects and filtering redirect_uri
- Enhance code quality through sonarcloud.io or similar HOT 1
- Allow inserted ID to be returned
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wpcom-legacy-redirector.