Files
piratepoet/mailpoet/lib/Automation/Engine/Engine.php
Jan Jakes 55a25427fc Add initialize hook to register automation integrations
Those need to be registered after Automation engine is initialized.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00

36 lines
786 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine;
use MailPoet\Automation\Engine\API\API;
class Engine {
/** @var API */
private $api;
/** @var Registry */
private $registry;
/** @var WordPress */
private $wordPress;
public function __construct(
API $api,
Registry $registry,
WordPress $wordPress
) {
$this->api = $api;
$this->registry = $registry;
$this->wordPress = $wordPress;
}
public function initialize(): void {
// register Action Scheduler (when behind feature flag, do it only on initialization)
require_once __DIR__ . '/../../../vendor/woocommerce/action-scheduler/action-scheduler.php';
$this->api->initialize();
$this->wordPress->doAction(Hooks::INITIALIZE, [$this->registry]);
}
}