Automattic\WooCommerce\Internal\StockNotifications
DataRetentionController::schedule_or_unschedule_daily_task
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.
Method of the class: DataRetentionController{}
No Hooks.
Returns
null. Nothing (null).
Usage
$DataRetentionController = new DataRetentionController(); $DataRetentionController->schedule_or_unschedule_daily_task( $unused, $new_option_value ): void;
- $unused(mixed) (required)
- The old option value or option name (not used in this function).
- $new_option_value(mixed) (required)
- The new value of the option.
DataRetentionController::schedule_or_unschedule_daily_task() DataRetentionController::schedule or unschedule daily task code WC 10.3.6
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 );
}
}