wpsc_cancel_preload()WPSCache 1.0

No Hooks.

Return

null. Nothing (null).

Usage

wpsc_cancel_preload();

wpsc_cancel_preload() code WPSCache 1.12.1

function wpsc_cancel_preload() {
	$next_preload      = wp_next_scheduled( 'wp_cache_preload_hook' );
	$next_full_preload = wp_next_scheduled( 'wp_cache_full_preload_hook' );

	if ( $next_preload || $next_full_preload ) {
		wp_cache_debug( 'wpsc_cancel_preload: reset preload settings' );
		wpsc_reset_preload_settings();
	}

	if ( $next_preload ) {
		wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_preload_hook' );
		wp_unschedule_event( $next_preload, 'wp_cache_preload_hook' );
	}
	if ( $next_full_preload ) {
		wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_full_preload_hook' );
		wp_unschedule_event( $next_full_preload, 'wp_cache_full_preload_hook' );
	}
	wp_cache_debug( 'wpsc_cancel_preload: creating stop_preload.txt' );

	/*
	* Reset the preload settings, but also create the stop_preload.txt file to
	* prevent the preload from starting again.
	* By creating the stop_preload.txt file, we can be sure the preload will cancel.
	*/
	wpsc_reset_preload_settings();
	wpsc_create_stop_preload_flag();
	wpsc_update_idle_preload( time() );
}