Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/hostinge.../includes/Admin/Jobs
File: AbstractJob.php
<?php
[0] Fix | Delete
declare( strict_types=1 );
[1] Fix | Delete
[2] Fix | Delete
namespace Hostinger\Admin\Jobs;
[3] Fix | Delete
[4] Fix | Delete
use Exception;
[5] Fix | Delete
[6] Fix | Delete
defined( 'ABSPATH' ) || exit;
[7] Fix | Delete
[8] Fix | Delete
abstract class AbstractJob implements JobInterface {
[9] Fix | Delete
[10] Fix | Delete
protected ActionScheduler $action_scheduler;
[11] Fix | Delete
[12] Fix | Delete
public function __construct( ActionScheduler $action_scheduler ) {
[13] Fix | Delete
$this->action_scheduler = $action_scheduler;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
public function init(): void {
[17] Fix | Delete
add_action( $this->get_process_item_hook(), array( $this, 'handle_process_items_action' ) );
[18] Fix | Delete
add_action(
[19] Fix | Delete
$this->get_start_hook(),
[20] Fix | Delete
function ( $args ) {
[21] Fix | Delete
$this->schedule( $args );
[22] Fix | Delete
}
[23] Fix | Delete
);
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
public function can_schedule( $args = array() ): bool {
[27] Fix | Delete
return ! $this->is_running( $args );
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
public function handle_process_items_action( array $args = array() ): void {
[31] Fix | Delete
$this->process_items( $args );
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
public function get_process_item_hook(): string {
[35] Fix | Delete
return "{$this->get_hook_base_name()}process_item";
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function get_start_hook(): string {
[39] Fix | Delete
return $this->get_name();
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
protected function is_running( ?array $args = array() ): bool {
[43] Fix | Delete
return $this->action_scheduler->has_scheduled_action( $this->get_process_item_hook(), array( $args ) );
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
protected function get_hook_base_name(): string {
[47] Fix | Delete
return "{$this->action_scheduler->get_group()}/jobs/{$this->get_name()}/";
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
abstract public function get_name(): string;
[51] Fix | Delete
abstract protected function process_items( array $args );
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function