wpsharks / comet-cache

An advanced WordPress® caching plugin inspired by simplicity.
https://cometcache.com
GNU General Public License v3.0
77 stars 18 forks source link

Compat.: Activation Status Plugin #870

Open jaswrks opened 7 years ago

jaswrks commented 7 years ago

A customer writes...

When using the Activation Status plugin to check where each plugin is activated in which subsite on the network, Comet Cache clears the cache.

Referencing internal/private ticket: https://app.intercom.io/a/apps/zbpo3mkk/inbox/me@jaswsinc.com/conversations/7521487261

Apparently this plugin changes something in WordPress that results in the cache being cleared at a time when it is otherwise unexpected. If possible, we should try to run some tests against this plugin and learn more. I'm going to ask the customer to add feedback that might help.

danielmt2k commented 7 years ago

Hi,

It happens just by activating/deactivating the plugin. In both cases, it wipes the whole cache.

I've been taking a quick look at the code, and it just queries the database to check plugin activation (wp_XX_option tables). So I don't see the point to wipe the whole cache.

Thanks.

raamdev commented 7 years ago

@danielmt2k Clearing the entire cache on activation/deactivation of a plugin is expected behavior. Comet Cache does that because it has no way of knowing if the plugin being activated/deactivated changes the output on the front-end of the site. If the plugin being activated/deactivated did affect the front-end of the site, then deactivating/activating the plugin would cause (potentially) the entire cache to become outdated, so the entire cache needs to be cleared to be safe.

If you want to disable this automatic clear/wipe behavior, please see Disabling Automatic Clear / Wipe Cache Routines.

danielmt2k commented 7 years ago

Hi @raamdev,

This plugin has only one purpose, to check which other plugins are activated in a network. So it runs only on the main subsite of the network, and does nothing on the front end.

It runs on the admin (back-end) of Wordpress, nothing is changed on the front. So it would be desirable that the cache is not wiped for the whole network.

Regards, Daniel.

danielmt2k commented 7 years ago

FYI, the plugin is not even network activated, just activated/deactivated on the main subsite of the network.

raamdev commented 7 years ago

@danielmt2k Please re-read what I said above:

Comet Cache does that because it has no way of knowing if the plugin being activated/deactivated changes the output on the front-end of the site.

danielmt2k commented 7 years ago

Hi @raamdev ,

I’ve created a MU plugin with this content:

add_filter('comet_cache_disable_auto_wipe_cache_routines', '__return_true', 10, 0);
add_filter('comet_cache_disable_auto_clear_cache_routines', '__return_true', 10, 0);

I wanted to disable the auto-wipe routines. But I’m checking that in some websites where I have posts scheduled, the home page is not being cleared to update the new posts being automatically published.

Is it because the second filter? The disable_auto_clear_cache_routines? Because I only want to avoid the auto-wiping when activating some plugins. But I don’t want the scheduling in WordPress to be affected. I thought the automatic tasks in WordPress won’t be affected by this 2 filters.

Please confirm. Thanks, Daniel.

raamdev commented 7 years ago

I thought the automatic tasks in WordPress won’t be affected by this 2 filters.

Those two filters specifically disable the automatic tasks, i.e., those filters are designed to disable all of the Comet Cache automatic routines. We don't recommend doing this because those automatic routines ensure that the cache gets cleared automatically whenever it's supposed to be cleared (e.g., when a scheduled post gets published).

Your options are to remove those filters (and thereby re-enable the automatic routines) or use the Comet Cache API to write some of your own code that hooks into various events (e.g., save_post, delete_post, etc) and clears the cache when appropriate.

If you're just trying to disable the auto-clear routines for Plugin Activation/Deactivation, you can try this filter instead:

add_filter('comet_cache_auto_clear_on_plugin_activation_deactivation', '__return_false', 10, 0);
danielmt2k commented 7 years ago

Ok,

Do I put this filter in the MU plugin created replacing the other 2 lines? So this filter won't wipe the cache when a plugin is activated in the main's netwok site of a multisite install?

Thanks.

raamdev commented 7 years ago

Yes, that's correct.

danielmt2k commented 6 years ago

Hi,

I’m migrating from a multisite install, and in one of the new single installs it seems to have found a bug.

The website is http://www.afreiresparragos.com http://www.afreiresparragos.com/ and at the end of the source code you can read: "<!-- Comet Cache is NOT caching this page, because the current user appeared to be logged into the site (in one way or another); but Comet Cache was unable to formulate a User Token for them. Please report this as a possible bug. —>”

Regards, Daniel.

El 19 ene 2017, a las 20:08, Raam Dev notifications@github.com escribió:

Yes, that's correct.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/websharks/comet-cache/issues/870#issuecomment-273868313, or mute the thread https://github.com/notifications/unsubscribe-auth/AGIkavY7nGoowBf6fNGjXCE7F-JPRW63ks5rT7S5gaJpZM4LYQcA.