| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Queue; |
| 4 |
|
| 5 |
defined('ABSPATH') || exit; |
| 6 |
abstract class QueueAbstract |
| 7 |
{ |
| 8 |
protected $queueManager; |
| 9 |
public $NEED_SCHEDULE = false; |
| 10 |
|
| 11 |
public function __construct() |
| 12 |
{ |
| 13 |
$this->queueManager = new QueueManager($this->getHookName()); |
| 14 |
} |
| 15 |
|
| 16 |
public function registerHooks() |
| 17 |
{ |
| 18 |
add_action($this->getHookName(), [$this, 'handle'], 10, 1); |
| 19 |
} |
| 20 |
|
| 21 |
protected function getLastRunTimestamp() |
| 22 |
{ |
| 23 |
return intval(get_option($this->getHookName() . '_last_run', time())); |
| 24 |
} |
| 25 |
|
| 26 |
abstract public function handle($args); |
| 27 |
|
| 28 |
abstract protected function getHookName(); |
| 29 |
} |
| 30 |
|