-
Notifications
You must be signed in to change notification settings - Fork 20
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
Only allow force deactivated plugins to be activated with SQ1_DEBUG #841
base: main
Are you sure you want to change the base?
Conversation
Why add another define we have to track? Why not key off the WP_ENVIROMENT_TYPE instead? You noted we shoudn't activate some plugins in development, and WP_ENVIROMENT_TYPE can provide that, can't it? |
Because Take this example:
In this scenario with the logic before this PR, that plugin would be auto tweeting if it was ever previously activated (e.g. when you did a database clone from production to dev, for example). The Without this, you'd have to switch the environment type to production to test this, therefore unexpectedly disabling Glomar's protection to the site and enabling other 3rd party plugins that automatically deactivate some features when the environment type is not production. We've seen the consequences of that in the past when a dev server gets picked up by Google unexpectedly. I added the define to the sample only for visibility, so developers know it's there, but it can be removed or just commented out or perhaps add more context for it in a comment as well. Hope this makes sense. |
I should add, if the host already has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might not be completely understanding but why not just check the WP_ENVIRONMENT_TYPE
instead of WP_DEBUG
?
After reading it over again, wouldn't it be simpler to just ensure WP_DEBUG is properly set? It this situation we now have a bool we set to make sure if another bool isn't set we fix the issue. Setting the original bool properly seems like the simpler choice. |
Because developers need a way to explicitly enable force disabled plugins for debugging, in a non-unexpected way. If you wanted to debug some plugin you force deactivated in a situation where it's only happening on a remote server, without a secondary check you would set
I'm not sure what the big deal about one more define is. Scenarios:
A week later...
Everything's fine for now but then a month later... QA asks for production data on the develop server to test a different feature, someone has WP Engine clone the production environment but has now forgotten to check 1000 tweets go out. |
I don't have an issue with another define, my concern is with not intuitively knowing what this one does differently than the others. In your example, it would be better to create a define called ACTIVATE_AUTO_TWEET or something like that and then customizing the force activation for that specific use case. |
Can you give me a code example of what you mean here and let me know how it prevents the scenarios I outlined above? |
Thanks for the longer explanation. I think it's fine but I would rename the SQ1_DEBUG to SQ1_FORCE_INACTIVE_PLUGINS so it's 100% clear what it does. SQ1_DEBUG for the unaware is not very clear. |
Fair. I named it that because I was thinking it could be used for other things. Thinking about that again, it would create the same cross dependency where one should only specifically activate force deactivated plugins when they're absolutely sure it's safe to do so and the define should only do just that one thing. I'll update after lunch. |
Has this gone stale? Or is it still relevant @defunctl (I assume so) |
What does this do/fix?
If you're utilizing
WP_ENVIRONMENT_TYPE
defines on some hosts, setting that todevelopment
would lead to plugins being allowed active that should never. For example for clients using Jetpack or anything that publishes out to a 3rd party, those plugins would remain active ifWP_DEBUG
wasn't defined in the host'swp-config.php
and lead to some unexpected surprises.QA
$force_inactive[]
array should not be able to be activated whenWP_ENVIRONMENT_TYPE
is not set to production.define( 'SQ1_DEBUG', true );
in yourwp-config.php
will allow those plugins to be activated, and if they were previously activated in the database, will now be active.Tests
Does this have tests?