m4i / wordpress-mo-cache

Improving the site performance by caching translation files using the WordPress standard cache mechanism.
http://wordpress.org/extend/plugins/mo-cache/
15 stars 4 forks source link

Delete cache entry on pluging update/install/remove #2

Open gagarine opened 9 years ago

gagarine commented 9 years ago

We should do a wp_cache_delete when plugin changes.

khromov commented 9 years ago

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

bueltge commented 8 years ago

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?

khromov commented 8 years ago

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

bueltge commented 8 years ago

@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 commented 7 years ago

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.

szepeviktor commented 7 years ago

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...