Add empty automation initializer

[MAILPOET-4135]
This commit is contained in:
Jan Jakes
2022-02-09 15:14:04 +01:00
committed by Veljko V
parent 9dc2809462
commit ddb04feef4
3 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation;
class Automation {
public function initialize(): void {
}
}

View File

@@ -4,7 +4,9 @@ namespace MailPoet\Config;
use MailPoet\API\JSON\API; use MailPoet\API\JSON\API;
use MailPoet\AutomaticEmails\AutomaticEmails; use MailPoet\AutomaticEmails\AutomaticEmails;
use MailPoet\Automation\Automation;
use MailPoet\Cron\CronTrigger; use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\InvalidStateException; use MailPoet\InvalidStateException;
use MailPoet\PostEditorBlocks\PostEditorBlock; use MailPoet\PostEditorBlocks\PostEditorBlock;
use MailPoet\PostEditorBlocks\WooCommerceBlocksIntegration; use MailPoet\PostEditorBlocks\WooCommerceBlocksIntegration;
@@ -86,6 +88,12 @@ class Initializer {
/** @var SubscriberActivityTracker */ /** @var SubscriberActivityTracker */
private $subscriberActivityTracker; private $subscriberActivityTracker;
/** @var Automation */
private $automation;
/** @var FeaturesController */
private $featuresController;
const INITIALIZED = 'MAILPOET_INITIALIZED'; const INITIALIZED = 'MAILPOET_INITIALIZED';
public function __construct( public function __construct(
@@ -109,7 +117,9 @@ class Initializer {
Localizer $localizer, Localizer $localizer,
AutomaticEmails $automaticEmails, AutomaticEmails $automaticEmails,
SubscriberActivityTracker $subscriberActivityTracker, SubscriberActivityTracker $subscriberActivityTracker,
AssetsLoader $assetsLoader AssetsLoader $assetsLoader,
Automation $automation,
FeaturesController $featuresController
) { ) {
$this->rendererFactory = $rendererFactory; $this->rendererFactory = $rendererFactory;
$this->accessControl = $accessControl; $this->accessControl = $accessControl;
@@ -132,6 +142,8 @@ class Initializer {
$this->automaticEmails = $automaticEmails; $this->automaticEmails = $automaticEmails;
$this->subscriberActivityTracker = $subscriberActivityTracker; $this->subscriberActivityTracker = $subscriberActivityTracker;
$this->assetsLoader = $assetsLoader; $this->assetsLoader = $assetsLoader;
$this->automation = $automation;
$this->featuresController = $featuresController;
} }
public function init() { public function init() {
@@ -151,6 +163,10 @@ class Initializer {
)); ));
} }
if ($this->featuresController->isSupported(FeaturesController::AUTOMATION)) {
$this->automation->initialize();
}
// activation function // activation function
WPFunctions::get()->registerActivationHook( WPFunctions::get()->registerActivationHook(
Env::$file, Env::$file,

View File

@@ -100,6 +100,8 @@ class ContainerConfigurator implements IContainerConfigurator {
$container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\FirstPurchase::class)->setPublic(true); $container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\FirstPurchase::class)->setPublic(true);
$container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\PurchasedInCategory::class)->setPublic(true); $container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\PurchasedInCategory::class)->setPublic(true);
$container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\PurchasedProduct::class)->setPublic(true); $container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\PurchasedProduct::class)->setPublic(true);
// Automation
$container->autowire(\MailPoet\Automation\Automation::class)->setPublic(true);
// Config // Config
$container->autowire(\MailPoet\Config\AccessControl::class)->setPublic(true); $container->autowire(\MailPoet\Config\AccessControl::class)->setPublic(true);
$container->autowire(\MailPoet\Config\Activator::class)->setPublic(true); $container->autowire(\MailPoet\Config\Activator::class)->setPublic(true);