wp_cache_time_update()
No Hooks.
Return
null
. Nothing (null).
Usage
wp_cache_time_update();
wp_cache_time_update() wp cache time update code WPSCache 1.12.4
function wp_cache_time_update() { global $cache_max_time, $wp_cache_config_file, $valid_nonce, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me; if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'expirytime' ) { if ( false == $valid_nonce ) return false; if( !isset( $cache_schedule_type ) ) { $cache_schedule_type = 'interval'; wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file); } if( !isset( $cache_scheduled_time ) ) { $cache_scheduled_time = '00:00'; wp_cache_replace_line('^ *\$cache_scheduled_time', "\$cache_scheduled_time = '$cache_scheduled_time';", $wp_cache_config_file); } if( !isset( $cache_max_time ) ) { $cache_max_time = 3600; wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = $cache_max_time;", $wp_cache_config_file); } if ( !isset( $cache_time_interval ) ) { $cache_time_interval = $cache_max_time; wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file); } if ( isset( $_POST['wp_max_time'] ) ) { $cache_max_time = (int)$_POST['wp_max_time']; wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = $cache_max_time;", $wp_cache_config_file); // schedule gc watcher if ( false == wp_next_scheduled( 'wp_cache_gc_watcher' ) ) wp_schedule_event( time()+600, 'hourly', 'wp_cache_gc_watcher' ); } if ( isset( $_POST[ 'cache_gc_email_me' ] ) ) { $cache_gc_email_me = 1; wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file); } else { $cache_gc_email_me = 0; wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file); } if ( isset( $_POST[ 'cache_schedule_type' ] ) && $_POST[ 'cache_schedule_type' ] == 'interval' && isset( $_POST['cache_time_interval'] ) ) { wp_clear_scheduled_hook( 'wp_cache_gc' ); $cache_schedule_type = 'interval'; if ( (int)$_POST[ 'cache_time_interval' ] == 0 ) $_POST[ 'cache_time_interval' ] = 600; $cache_time_interval = (int)$_POST[ 'cache_time_interval' ]; wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' ); wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file); wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file); } else { // clock wp_clear_scheduled_hook( 'wp_cache_gc' ); $cache_schedule_type = 'time'; if ( !isset( $_POST[ 'cache_scheduled_time' ] ) || $_POST[ 'cache_scheduled_time' ] == '' || 5 != strlen( $_POST[ 'cache_scheduled_time' ] ) || ":" != substr( $_POST[ 'cache_scheduled_time' ], 2, 1 ) ) $_POST[ 'cache_scheduled_time' ] = '00:00'; $cache_scheduled_time = $_POST[ 'cache_scheduled_time' ]; if ( ! preg_match( '/[0-9][0-9]:[0-9][0-9]/', $cache_scheduled_time ) ) { $cache_scheduled_time = '00:00'; } $schedules = wp_get_schedules(); if ( !isset( $cache_schedule_interval ) ) $cache_schedule_interval = 'daily'; if ( isset( $_POST[ 'cache_schedule_interval' ] ) && isset( $schedules[ $_POST[ 'cache_schedule_interval' ] ] ) ) $cache_schedule_interval = $_POST[ 'cache_schedule_interval' ]; wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file); wp_cache_replace_line('^ *\$cache_schedule_interval', "\$cache_schedule_interval = '{$cache_schedule_interval}';", $wp_cache_config_file); wp_cache_replace_line('^ *\$cache_scheduled_time', "\$cache_scheduled_time = '$cache_scheduled_time';", $wp_cache_config_file); wp_schedule_event( strtotime( $cache_scheduled_time ), $cache_schedule_interval, 'wp_cache_gc' ); } } }