Add simple Action Scheduler wrapper service

[MAILPOET-4136]
This commit is contained in:
Jan Jakes
2022-03-07 12:06:56 +01:00
committed by Veljko V
parent e4b09ab6de
commit 6d040571aa
2 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Control;
class ActionScheduler {
private const GROUP_ID = 'mailpoet-automation';
public function enqueue(string $hook, array $args = []): int {
return as_enqueue_async_action($hook, $args, self::GROUP_ID);
}
public function schedule(int $timestamp, string $hook, array $args = []): int {
return as_schedule_single_action($timestamp, $hook, $args, self::GROUP_ID);
}
}