wordpress-mo-cache icon indicating copy to clipboard operation
wordpress-mo-cache copied to clipboard

Delete cache entry on pluging update/install/remove

Open gagarine opened this issue 10 years ago • 6 comments

We should do a wp_cache_delete when plugin changes.

gagarine avatar Apr 21 '15 20:04 gagarine

register_activation_hook() is quite a pain but you should be able to hook on "pre_update_option_active_plugins", which will be updated when the active plugins list changes.

https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_update_option_%28option_name%29

khromov avatar Apr 21 '15 20:04 khromov

I think, you should fire the delete cache on activated_plugin and deactivated_plugin hook. So you are sure, that on the activation, deactivation you kill the cache and rebuild after this. Are pull requests accepted?

bueltge avatar Oct 24 '16 20:10 bueltge

Sounds like a good idea @bueltge

If PR not accepted, I will happily accept it in my fork -> https://github.com/khromov/wordpress-mo-cache

khromov avatar Oct 24 '16 21:10 khromov

@khromov maybe you should send a pull request before, that new changes passed and I (also others) see the difference between this version and your maintained version?

Also we should fired the function to delete the cache on switching theme. Also themes have translation files. I see the hook switch_theme as the right point. But what is with the translation files with the core, should we also flush the cache after update translation files?

bueltge avatar Oct 25 '16 13:10 bueltge

We have rewrite the plugin. The enhancement and changes for this older version was to much, the result was a refactoring. But I think a really good result, that's helps all. You find it here - https://github.com/inpsyde/translation-cache Feedback are really welcome.

bueltge avatar Nov 02 '16 07:11 bueltge

Feedback are really welcome.

Very nice plugin. Has a bit more user friendliness in it which is not necessary in a controlled environment.

Here is my tiny approach on caching .mo files https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/tiny-translation-cache.php I am working on automated purging right now...

szepeviktor avatar May 13 '17 18:05 szepeviktor