wpsc_update_active_preload()WPSCache 1.0

Update the preload status file during a preload.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpsc_update_active_preload( $group, $progress, $url );
$group **
-
По умолчанию: null
$progress **
-
По умолчанию: null
$url **
-
По умолчанию: null

Код wpsc_update_active_preload() WPSCache 1.12.4

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 ) ) ) {
		wp_cache_debug( "wpsc_update_active_preload: failed to write to $filename" );
	}
}