WordPress.org

Plugin Directory

Changeset 577987


Ignore:
Timestamp:
07/27/12 09:14:52 (21 months ago)
Author:
donncha
Message:

Enable garbage collection when activating caching

File:
1 edited

Legend:

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

    r576527 r577987  
    352352function wp_cache_manager_updates() { 
    353353    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; 
    354355 
    355356    if ( !wpsupercache_site_admin() ) 
    356357        return false; 
     358 
     359    // set up garbage collection with some default settings 
     360    if ( false == wp_next_scheduled( 'wp_cache_gc' ) ) { 
     361        if ( false == isset( $cache_schedule_type ) ) { 
     362            $cache_schedule_type = 'interval'; 
     363            $cache_time_interval = 600; 
     364            $cache_max_time = 1800; 
     365            wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file); 
     366            wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file); 
     367            wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = '$cache_max_time';", $wp_cache_config_file); 
     368        } 
     369        wp_schedule_single_event( time() + 600, 'wp_cache_gc' ); 
     370    } 
    357371 
    358372    if ( false == isset( $cache_page_secret ) ) { 
Note: See TracChangeset for help on using the changeset viewer.