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\AutomaticEmails\AutomaticEmails;
use MailPoet\Automation\Automation;
use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\InvalidStateException;
use MailPoet\PostEditorBlocks\PostEditorBlock;
use MailPoet\PostEditorBlocks\WooCommerceBlocksIntegration;
@@ -86,6 +88,12 @@ class Initializer {
/** @var SubscriberActivityTracker */
private $subscriberActivityTracker;
/** @var Automation */
private $automation;
/** @var FeaturesController */
private $featuresController;
const INITIALIZED = 'MAILPOET_INITIALIZED';
public function __construct(
@@ -109,7 +117,9 @@ class Initializer {
Localizer $localizer,
AutomaticEmails $automaticEmails,
SubscriberActivityTracker $subscriberActivityTracker,
AssetsLoader $assetsLoader
AssetsLoader $assetsLoader,
Automation $automation,
FeaturesController $featuresController
) {
$this->rendererFactory = $rendererFactory;
$this->accessControl = $accessControl;
@@ -132,6 +142,8 @@ class Initializer {
$this->automaticEmails = $automaticEmails;
$this->subscriberActivityTracker = $subscriberActivityTracker;
$this->assetsLoader = $assetsLoader;
$this->automation = $automation;
$this->featuresController = $featuresController;
}
public function init() {
@@ -151,6 +163,10 @@ class Initializer {
));
}
if ($this->featuresController->isSupported(FeaturesController::AUTOMATION)) {
$this->automation->initialize();
}
// activation function
WPFunctions::get()->registerActivationHook(
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\PurchasedInCategory::class)->setPublic(true);
$container->autowire(\MailPoet\AutomaticEmails\WooCommerce\Events\PurchasedProduct::class)->setPublic(true);
// Automation
$container->autowire(\MailPoet\Automation\Automation::class)->setPublic(true);
// Config
$container->autowire(\MailPoet\Config\AccessControl::class)->setPublic(true);
$container->autowire(\MailPoet\Config\Activator::class)->setPublic(true);