Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter the_spy

    (@the_spy)

    Finally I have put back the “classic” wp cron system instead of calling it by crontab, and now I just call the index page with ?bla=1 by crontab to schedule and start wp cron.

    I call this page every 5 minutes, so the old cache is cleared every 10 minutes (first 5min to schedule the cron, next 5min to launch scheduled crons).

    Thanks

    Thread Starter the_spy

    (@the_spy)

    But now I’m not sure about one thing, does the normal WP cron call by WordPress is also adding “doing_wp_cron” ?

    I see this in my server logs:

    xxx.xxx.xxx.xxx – – [08/Jun/2011:09:00:01 +0200] “POST /wp-cron.php?doing_wp_cron HTTP/1.0” 200 173 “-” “WordPress/3.1.3; http://xxx.com”

    So there may be still a problem with the classic internal wp cron call, since it’s also adding a GET here.
    May be the test “if ( !empty($_GET) )” in phase2 should care of it.

    Thread Starter the_spy

    (@the_spy)

    After adding a lot of debug everywhere in phase2, I found the problem !

    It was the problem noticed above, the super_cache_enabled was going to false, due to GET not empty.

    But why even in cron call ?

    Because in the crontab, I was calling “wp-cron.php?doing_wp_cron” , like it was in many tutorials “how to add wp cron in crontab”.

    Due to this wp super cache was detecting the GET “doing_wp_cron” and deactivated super cache. So the super cache garbage collector was not called.

    I just removed “doing_wp_cron” in crontab, and now it works perfectly !

    thanks

    Thread Starter the_spy

    (@the_spy)

    Ok I will continue my tests today and keep you posted here, I have to make it work 🙂

    Thread Starter the_spy

    (@the_spy)

    Ok I got the problem why the cache is still not cleared.

    The garbage collector is called correctly when I add ?bla=1 . But in the code posted above, there is:

    $super_cache_enabled = false;

    Then the problem is in the garbage collector, in the function prune_super_cache() , there is this test:

    if( !is_admin() && $super_cache_enabled == 0 )
                    return false;

    since $super_cache_enabled is global, it is false, and the super cache is not cleaned because the function stop here.

    So we still have a problem here I think 😉

    Thread Starter the_spy

    (@the_spy)

    If I call the index WP page with ?bla=1 , it’s doing a new cache, but not a good one.
    It’s generating a simple wp-cache html cache file, and not a super cache file, due to this part of code in phase2 I guess:

    if ( !empty( $_GET ) ) {
                    if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'Supercache caching disabled. Only using wp-cache. Non emp
    ty GET request.', 5 );
                    $super_cache_enabled = false;
            }

    but it should still call the garbage collector I think… but for now it doesn’t, I try to check why.

    Thread Starter the_spy

    (@the_spy)

    I don’t think it will solve the problem.

    wp-cron.php is already an uncacheable page, due to this restriction in default settings:
    wp-.*\.php

    And I call the wp-cron page every 5 minutes by crontab.

    But in your code, when a page is marked as uncacheable, the phase 2 is stopped before the garbage system is called, so the GC is never called after this :

    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($wp_cache_request_uri)) {
                    if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'URI rejected. Not Caching', 2 );
                    return false;
            }

    So if I’m not wrong, I think there is no way to refresh the cache actually with the mod_rewrite cache configuration.

Viewing 7 replies - 1 through 7 (of 7 total)