wpsc_update_active_preload()
Update the preload status file during a preload.
No Hooks.
Returns
null. Nothing (null).
Usage
wpsc_update_active_preload( $group, $progress, $url );
- $group
- .
Default:null - $progress
- .
Default:null - $url
- .
Default:null
wpsc_update_active_preload() wpsc update active preload code WPSCache 3.1.0
function wpsc_update_active_preload( $group = null, $progress = null, $url = null ) {
$preload_status = wpsc_get_preload_status();
$preload_status['running'] = true;
// Add the new entry to the history.
array_unshift(
$preload_status['history'],
array(
'group' => $group,
'progress' => $progress,
'url' => $url,
)
);
// Limit to 5 in the history.
$preload_status['history'] = array_slice( $preload_status['history'], 0, 5 );
$filename = wpsc_get_preload_status_file_path();
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents
if ( false === file_put_contents( $filename, wp_json_encode( $preload_status, JSON_UNESCAPED_SLASHES ) ) ) {
wp_cache_debug( "wpsc_update_active_preload: failed to write to $filename" );
}
}