| Server IP : 77.37.83.169 / Your IP :
216.73.216.146 [
Web Server : LiteSpeed System : Linux nl-srv-web1124.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : u964240598 ( 964240598) PHP Version : 8.4.19 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u964240598/public_html/jobs/wp-content/plugins/hostinger/includes/Admin/Jobs/ |
Upload File : |
<?php
declare( strict_types=1 );
namespace Hostinger\Admin\Jobs;
use Exception;
defined( 'ABSPATH' ) || exit;
abstract class AbstractJob implements JobInterface {
protected ActionScheduler $action_scheduler;
public function __construct( ActionScheduler $action_scheduler ) {
$this->action_scheduler = $action_scheduler;
}
public function init(): void {
add_action( $this->get_process_item_hook(), array( $this, 'handle_process_items_action' ) );
add_action(
$this->get_start_hook(),
function ( $args ) {
$this->schedule( $args );
}
);
}
public function can_schedule( $args = array() ): bool {
return ! $this->is_running( $args );
}
public function handle_process_items_action( array $args = array() ): void {
$this->process_items( $args );
}
public function get_process_item_hook(): string {
return "{$this->get_hook_base_name()}process_item";
}
public function get_start_hook(): string {
return $this->get_name();
}
protected function is_running( ?array $args = array() ): bool {
return $this->action_scheduler->has_scheduled_action( $this->get_process_item_hook(), array( $args ) );
}
protected function get_hook_base_name(): string {
return "{$this->action_scheduler->get_group()}/jobs/{$this->get_name()}/";
}
abstract public function get_name(): string;
abstract protected function process_items( array $args );
}
Anon7 - 2022
AnonSec Team
