• Resolved marcoskito

    (@marcoskito)


    Hello, when saving a page in draft, the cache is cleared.
    For example, I press to write a new post, any time I press save draft, the entire plugin cache is deleted, this happens every time the save draft button is pressed.
    I wanted to know if this is a problem with the plugin or is it something that was actually supposed to happen?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Did the problem start with the update last week (version 1.12.0)?

    I have used this plugin for many years, and I have never experienced that all cache is deleted when saving a draft. I was thinking of updating to 1.12.0 today, but I will wait until we hear from the plugin author.

    Edit:
    Do you, by any chance, have “Clear all cache files when a post or page is published or updated” enabled in the Advanced tab in the plugin settings? I have it disabled/off.

    • This reply was modified 8 months, 1 week ago by yallaman.
    Thread Starter marcoskito

    (@marcoskito)

    I started using the plugin in the most current version, 1.12.0.
    I did the test here with and without the option “Clear all cache files when a post or page is published or updated” , but the result is the same.

    Strange. Two weeks ago another user had the same problem:
    https://www.ads-software.com/support/topic/full-cache-delete-on-post-edit/

    The issue was not resolved (because he moved on to another caching plugin). Hopefully the plugin author can chime in.

    @marcoskito I created a few test posts on a site and then created another post I did not publish, but I saved it as a draft post. The posts I had already published were still cached. I saw this in the debug log:

    wp_cache_post_edit: draft post, not deleting any cache files. status: draft
    wp_cache_post_change: draft post, not deleting any cache files.

    Was the post you were editing a new post, or one that had been published before, but you changed to a draft? If it was a post that had been published before, then the cache files for only that post should have been deleted.

    Please enable debugging in the plugin. If you change a published post to a draft post, you should see the line “wpsc_post_transition: deleting cache of post:” in the debug log with the URL of your post. The following lines of the log will show you what was deleted:

    wpsc_delete_files: deleting [URL]

    @yallaman – If there is a problem with this, then it’s a very rare bug. Hopefully, @marcoskito can reply with some information after looking at their debug log.

    Thread Starter marcoskito

    (@marcoskito)

    Hi @donncha,
    The cache is cleared when an unpublished post has a draft saved.
    I deactivated practically all the plugins, leaving only the basic ones (Elementor, Rank Math SEO, WP Super Cache and those of the theme itself, SmartMag Core and Sphere Core).
    In debugging, in the log, wpsc_delete_files does not appear anywhere.
    When the post draft is saved, the log shows the following:

    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user wp_cache_replace_line: setting not changed - $wp_cache_debug_log = '63082ab0055fe7dc1dd6946f861c4c58.php';
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user wp_cache_replace_line: setting not changed - $wp_cache_debug_username = 'f17013a12153ec402d79b90ef065f37c';
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/index.html
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/.htaccess as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/.htaccess
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/.htaccess as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/meta/index.html
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/supercache/index.html
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache/index.html as it's protected.
    12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache as it's protected.
    12:47:48 24268 /wp-admin/post.php?post=187210&action=edit&message=4 wp_cache_postload: DONOTCACHEPAGE defined. Not running.


    After that, it starts loading pages to cache normally.

    • This reply was modified 8 months, 1 week ago by marcoskito.

    @marcoskito that’s really weird. It seems to me that WP Super Cache isn’t deleting the cache, but some other code on your server is.

    If you can replicate your server on a test server, and then disable those plugins and change your theme you might be able to figure out which one is causing the problem.

    Thread Starter marcoskito

    (@marcoskito)

    @donncha, just returning to let you know that it’s something related to the theme, when putting the default WordPress theme, the cache is not cleared when a draft is saved.
    I’m going to contact the developer to see if he can resolve it, but I wanted to know if there is any way to not allow other plugins or themes to clear the cache.

    There isn’t a way to stop other plugins or themes from deleting the cache. Extra security key measures might be put in place but the files are created by the web server so any PHP code on the server could go through the files deleting them, no matter what the plugin does.

    Thread Starter marcoskito

    (@marcoskito)

    @donncha, let me be clearer, I wanted to know if there is a way to prevent other plugins from asking WP Super Cache to clean their cache? This way, the plugin would be solely responsible for cleaning, without others getting in the way or asking it to do so.
    Would it be possible to create an option to remove the cleaning hooks that other plugins use to ask WP Super Cache to do this cleaning, if an option in the plugin itself is not possible, is there any way to do this?

    There isn’t a way to do what you want, and no point in trying to stop other plugins clearing the cache, sorry.

    It could possibly be done by rewriting the plugin using classes and making anything that cleared the cache a private function, but then another plugin just needs to manually delete the cache folder with their own recursive function.

    Thread Starter marcoskito

    (@marcoskito)

    @donncha, what I’m trying to say is that I know that other plugins have access to the cache folder and that they can do this, but they ask WP Super Cache to do it for them.
    I just wanted to prevent other plugins from asking WP Super Cache to clear the cache.
    For example, you have a plugin installed that does the following:

    if (function_exists('wp_cache_clear_cache')) {
    			wp_cache_clear_cache(
    				is_multisite() ? get_current_blog_id() : 0
    			);
    		}

    I just wish WP Super Cache didn’t recognize this command and didn’t clean it because of other plugins.
    I wanted WP Super Cache to be “isolated” from receiving commands from other plugins, and only delete the cache according to the settings.
    Would it be possible to do something like this as a function for the plugin or would deleting some lines for these functions be enough?

    • This reply was modified 7 months, 2 weeks ago by marcoskito.

    Unfortunately, you should probably report this as a bug to the other plugin or theme, as it’s too aggressive. There’s nothing this plugin can do, as that’s what it’s supposed to do.

    Hello @marcoskito

    I was with similar problem, after update product, all cache files deleted. I found Rank Math plugin delete all this. If someone have problem with that and have rank math plugin, in your theme functions add this:

    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.