WordPress.org

Plugin Directory

Changeset 578009


Ignore:
Timestamp:
07/27/12 09:39:59 (21 months ago)
Author:
donncha
Message:
  • Added a garbage collection watcher job to restart GC if it somehow fails.
  • Clear gc hooks when uninstalling
  • Added a check for shutdown gc when scheduling default gc
Location:
wp-super-cache/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-super-cache/trunk/wp-cache-phase2.php

    r561809 r578009  
    4141        add_action( 'clean_post_cache', 'wp_cache_post_edit' ); 
    4242        add_filter( 'supercache_filename_str', 'wp_cache_check_mobile' ); 
     43        add_action( 'wp_cache_gc_watcher', 'wp_cache_gc_watcher' ); 
    4344 
    4445        do_cacheaction( 'add_cacheaction' ); 
     
    12401241    } 
    12411242    if ( $cache_schedule_type == 'interval' ) { 
     1243        if ( !isset( $cache_max_time ) ) 
     1244            $cache_max_time = 600; 
    12421245        if ( $cache_max_time == 0 ) 
    12431246            return false; 
    1244         if ( !isset( $cache_max_time ) ) 
    1245             $cache_max_time = 600; 
    12461247        $last_gc = get_option( "wpsupercache_gc_time" ); 
    12471248 
     
    12691270} 
    12701271 
     1272function wp_cache_gc_watcher() { 
     1273    if ( wp_next_scheduled( 'wp_cache_gc' ) ) 
     1274        schedule_wp_gc(); 
     1275} 
     1276 
    12711277?> 
  • wp-super-cache/trunk/wp-cache.php

    r577987 r578009  
    116116    @unlink( $cache_path . 'supercache' ); 
    117117    wp_clear_scheduled_hook( 'wp_cache_check_site_hook' ); 
     118    wp_clear_scheduled_hook( 'wp_cache_gc' ); 
     119    wp_clear_scheduled_hook( 'wp_cache_gc_watcher' ); 
    118120    wp_cache_disable_plugin(); 
    119121} 
     
    352354function wp_cache_manager_updates() { 
    353355    global $wp_cache_mobile_enabled, $wp_supercache_cache_list, $wp_cache_config_file, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $cache_path, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $cache_compression, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $cache_page_secret, $wp_cache_disable_utf8, $wp_cache_no_cache_for_get; 
    354     global $cache_schedule_type, $cache_scheduled_time, $cache_max_time, $cache_time_interval; 
     356    global $cache_schedule_type, $cache_scheduled_time, $cache_max_time, $cache_time_interval, $wp_cache_shutdown_gc; 
    355357 
    356358    if ( !wpsupercache_site_admin() ) 
     
    358360 
    359361    // set up garbage collection with some default settings 
    360     if ( false == wp_next_scheduled( 'wp_cache_gc' ) ) { 
     362    if ( ( !isset( $wp_cache_shutdown_gc ) || $wp_cache_shutdown_gc == 0 ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) { 
    361363        if ( false == isset( $cache_schedule_type ) ) { 
    362364            $cache_schedule_type = 'interval'; 
     
    369371        wp_schedule_single_event( time() + 600, 'wp_cache_gc' ); 
    370372    } 
     373    // schedule gc watcher 
     374    if ( false == wp_next_scheduled( 'wp_cache_gc_watcher' ) ) 
     375        wp_schedule_event( time()+600, 'hourly', 'wp_cache_gc_watcher' ); 
    371376 
    372377    if ( false == isset( $cache_page_secret ) ) { 
Note: See TracChangeset for help on using the changeset viewer.