Automattic\WooCommerce\Internal\StockNotifications

DataRetentionController::schedule_or_unschedule_daily_task │ public │ WC 1.0

Responds to changes in the option for deleting unverified notifications. If the new value is numeric and greater than zero, it schedules a daily task. If the new value is not numeric or is empty, it clears the scheduled tasks.

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

Хуков нет.

Возвращает

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

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

$DataRetentionController = new DataRetentionController();
$DataRetentionController->schedule_or_unschedule_daily_task( $unused, $new_option_value ): void;
$unused(разное) (обязательный)
The old option value or option name (not used in this function).
$new_option_value(разное) (обязательный)
The new value of the option.

Код DataRetentionController::schedule_or_unschedule_daily_task() WC 11.2.2

public function schedule_or_unschedule_daily_task( $unused, $new_option_value ): void {
	if ( ! is_numeric( $new_option_value ) || empty( $new_option_value ) ) {
		$this->clear_daily_task();
		return;
	}

	if ( ! wp_next_scheduled( self::DAILY_TASK_HOOK ) ) {
		wp_schedule_event( time() + 10, 'daily', self::DAILY_TASK_HOOK );
	}
}