Automattic\WooCommerce\Internal\TransientFiles

TransientFilesEngine::add_debug_tools_entries()publicWC 1.0

Add the tools to (re)schedule and un-schedule the expired files cleanup actions in the WooCommerce debug tools page.

Метод класса: TransientFilesEngine{}

Хуков нет.

Возвращает

Массив. Updated debug tools array

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

$TransientFilesEngine = new TransientFilesEngine();
$TransientFilesEngine->add_debug_tools_entries( $tools_array ): array;
$tools_array(массив) (обязательный)
Original debug tools array.

Код TransientFilesEngine::add_debug_tools_entries() WC 9.6.1

public function add_debug_tools_entries( array $tools_array ): array {
	$cleanup_is_scheduled = $this->expired_files_cleanup_is_scheduled();

	$tools_array['schedule_expired_transient_files_cleanup'] = array(
		'name'             => $cleanup_is_scheduled ?
			__( 'Re-schedule expired transient files cleanup', 'woocommerce' ) :
			__( 'Schedule expired transient files cleanup', 'woocommerce' ),
		'desc'             => $cleanup_is_scheduled ?
			__( 'Remove the currently scheduled action to delete expired transient files, then schedule it again for running immediately. Subsequent actions will run once every 24h.', 'woocommerce' ) :
			__( 'Schedule the action to delete expired transient files for running immediately. Subsequent actions will run once every 24h.', 'woocommerce' ),
		'button'           => $cleanup_is_scheduled ?
			__( 'Re-schedule', 'woocommerce' ) :
			__( 'Schedule', 'woocommerce' ),
		'requires_refresh' => true,
		'callback'         => array( $this, 'schedule_expired_files_cleanup' ),
	);

	if ( $cleanup_is_scheduled ) {
		$tools_array['unschedule_expired_transient_files_cleanup'] = array(
			'name'             => __( 'Un-schedule expired transient files cleanup', 'woocommerce' ),
			'desc'             => __( "Remove the currently scheduled action to delete expired transient files. Expired files won't be automatically deleted until the 'Schedule expired transient files cleanup' tool is run again.", 'woocommerce' ),
			'button'           => __( 'Un-schedule', 'woocommerce' ),
			'requires_refresh' => true,
			'callback'         => array( $this, 'unschedule_expired_files_cleanup' ),
		);
	}

	return $tools_array;
}