WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
GC still refuses to run (1 post)

  1. tash7
    Member
    Posted 1 year ago #

    I have to add this code in order to get it to clear out expired pages. Without it, the status page helpfully displays that the GC will run at a time in the past. Hoping this gets fixed in the next update, because i have to go in and patch it every time. :-/

    --- wp-super-cache (1.2 master)/wp-cache-phase2.php	2012-10-05 11:45:26.000000000 -0400
    +++ wp-super-cache (1.2 modified)/wp-cache-phase2.php	2012-10-23 20:51:19.000000000 -0400
    @@ -1289,14 +1289,20 @@
     		if ( $forced || ( $last_gc < ( time() - 60 ) ) ) { // Allow up to 60 seconds for the previous job to run
     			global $wp_cache_shutdown_gc;
     			if ( !isset( $wp_cache_shutdown_gc ) || $wp_cache_shutdown_gc == 0 ) {
     				if ( !($t = wp_next_scheduled( 'wp_cache_gc' ) ) ) {
     					wp_clear_scheduled_hook( 'wp_cache_gc' );
     					wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' );
     					if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'scheduled wp_cache_gc for 10 seconds time.', 5 );
    +				} else {
    +					if ( $t < time() ) {
    +						// error_log("WPSuperCache: wp_cache_gc scheduled for ".$t." but has not run.  Clearing hook and forcing GC.");
    +						wp_clear_scheduled_hook( 'wp_cache_gc' );
    +						wp_cache_gc_cron();
    +					}
     				}
     			} else {
     				global $time_to_gc_cache;
     				$time_to_gc_cache = 1; // tell the "shutdown gc" to run!
     			}
     		}
     	} elseif ( $cache_schedule_type == 'time' && !wp_next_scheduled( 'wp_cache_gc' ) ) {

    http://wordpress.org/extend/plugins/wp-super-cache/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic