Git Product home page Git Product logo

Comments (5)

GaryJones avatar GaryJones commented on July 17, 2024

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.

mslinnea avatar mslinnea commented on July 17, 2024

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.

GaryJones avatar GaryJones commented on July 17, 2024

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.

mslinnea avatar mslinnea commented on July 17, 2024

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.

GaryJones avatar GaryJones commented on July 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.