| Server IP : 178.212.43.201 / Your IP : 10.100.0.33 Web Server : Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k System : Linux spa0007.srv.paxillus.pl 5.4.17-2136.355.3.1.el8uek.x86_64 #3 SMP Sat May 9 17:11:55 PDT 2026 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/suzuki/wp-content/plugins/amp/src/BackgroundTask/ |
Upload File : |
<?php
/**
* Abstract class CronBasedBackgroundTask.
*
* @package AmpProject\AmpWP
*/
namespace AmpProject\AmpWP\BackgroundTask;
use AmpProject\AmpWP\Infrastructure\Registerable;
use AmpProject\AmpWP\Infrastructure\Service;
/**
* Abstract base class for using cron to execute a background task.
*
* @package AmpProject\AmpWP
* @since 2.0
* @internal
*/
abstract class CronBasedBackgroundTask implements Service, Registerable {
const DEFAULT_INTERVAL_HOURLY = 'hourly';
const DEFAULT_INTERVAL_TWICE_DAILY = 'twicedaily';
const DEFAULT_INTERVAL_DAILY = 'daily';
/**
* BackgroundTaskDeactivator instance.
*
* @var BackgroundTaskDeactivator
*/
protected $background_task_deactivator;
/**
* Class constructor.
*
* @param BackgroundTaskDeactivator $background_task_deactivator Service that deactivates background events.
*/
public function __construct( BackgroundTaskDeactivator $background_task_deactivator ) {
$this->background_task_deactivator = $background_task_deactivator;
}
/**
* Register the service with the system.
*
* @return void
*/
public function register() {
$this->background_task_deactivator->add_event( $this->get_event_name() );
}
/**
* Schedule the event.
*
* @param mixed[] ...$args Arguments passed to the function from the action hook.
*/
abstract protected function schedule_event( ...$args );
/**
* Get the event name.
*
* This is the "slug" of the event, not the display name.
*
* Note: the event name should be prefixed to prevent naming collisions.
*
* @return string Name of the event.
*/
abstract protected function get_event_name();
/**
* Process the event.
*
* @param mixed[] ...$args Args to pass to the process callback.
*/
abstract public function process( ...$args );
}