wp plugin de/activate wp-rocket does not trigger .htaccess regeneration
vinnyusestrict opened this issue · 5 comments
When one activates or deactivates a plugin via wp-cli, one expects it to behave as it would when doing it via the UI.
When we activate or deactivate wp-rocket, .htaccess (and maybe others) file regeneration should be triggered as well.
This does not happen. Please consider adding support for that.
Cheers,
Vinny
Related ticket: https://secure.helpscout.net/mailbox/5de4805abf96951b/2683093/
Currently, the wp-rocket-cli activate and deactivate commands turn on/off the cache. This is a bit deceptive as the plugin itself remains otherwise active when deactivating, or if deactivated from the dashboard plugins page, doesn't actually activate anything. Not sure (yet) if that is the issue here or if OP is referring to running the wp-cli built in commands -- in any case we should consider renaming commands here to clarify what they do.
wp-cli has built-in functions to actually activate/deactivate the plugin itself:
- wp plugin activate
- wp plugin deactivate
Grooming Todo: check plugin is fully activated/deactivated when running the above.
I've checked this and it seems that when running the commands:
wp rocket activate
and wp rocket deactivate
it will simply set the constant define('WP_CACHE', $value )
The plugin itself will not be activated or deactivated.
I think the best solution in here is to rename the command to enable cache / disable cache. At this point I am concerned that it will be easily confused with only the WP Rocket cache which can be enabled / disabled with the filter: do_rocket_generate_caching_files
@wp-media/php what do you think about this one?
Identify the issue
Activate / deactivate simply updates the constant define('WP_CACHE', $value )
However, during this operation, WP Rocket needs to apply some other mandatory changes like:
- During Activation when WP_CACHE is set to true
- Add All WP Rocket rules of the .htaccess file.
- Delete current cache
- During deactivation when WP_CACHE is set to false
- Delete All WP Rocket rules of the .htaccess file.
- Clean current cache
Scope a solution
Rename both functions from activate
=> activate-cache
and deactivate
=> deactivate-cache
. This will make clear what is expected from this.
Update functions to do the expected
Estimate the effort
Effort [XS]
@crystinutzaa, Can we confirm that when running:
wp plugin activate wp-rocket
that the plugin is fully activated just as if it were activated from the WP Dashboard Plugin screen? Are all the necessary files (esp.htaccess
) written?wp plugin deactivate wp-rocket
that the plugin is fully deactivated, same as the WP Dashboard Plugin screen, and all the necessary files reset?