-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5480 from magento-trigger/MC-32086
[TR] [AR] Report account is unavailable after URL change
- Loading branch information
Showing
11 changed files
with
594 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
app/code/Magento/Analytics/Setup/Patch/Data/ActivateDataCollection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Analytics\Setup\Patch\Data; | ||
|
||
use Magento\Analytics\Model\Config\Backend\CollectionTime; | ||
use Magento\Analytics\Model\SubscriptionStatusProvider; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
|
||
/** | ||
* Activate data collection mechanism | ||
*/ | ||
class ActivateDataCollection implements DataPatchInterface | ||
{ | ||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* @var SubscriptionStatusProvider | ||
*/ | ||
private $subscriptionStatusProvider; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $analyticsCollectionTimeConfigPath = 'analytics/general/collection_time'; | ||
|
||
/** | ||
* @var CollectionTime | ||
*/ | ||
private $collectionTimeBackendModel; | ||
|
||
/** | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param SubscriptionStatusProvider $subscriptionStatusProvider | ||
* @param CollectionTime $collectionTimeBackendModel | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig, | ||
SubscriptionStatusProvider $subscriptionStatusProvider, | ||
CollectionTime $collectionTimeBackendModel | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
$this->subscriptionStatusProvider = $subscriptionStatusProvider; | ||
$this->collectionTimeBackendModel = $collectionTimeBackendModel; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* | ||
* @throws LocalizedException | ||
*/ | ||
public function apply() | ||
{ | ||
$subscriptionStatus = $this->subscriptionStatusProvider->getStatus(); | ||
$isCollectionProcessActivated = $this->scopeConfig->getValue(CollectionTime::CRON_SCHEDULE_PATH); | ||
if ($subscriptionStatus !== $this->subscriptionStatusProvider->getStatusForDisabledSubscription() | ||
&& !$isCollectionProcessActivated | ||
) { | ||
$this->collectionTimeBackendModel | ||
->setValue($this->scopeConfig->getValue($this->analyticsCollectionTimeConfigPath)); | ||
$this->collectionTimeBackendModel->setPath($this->analyticsCollectionTimeConfigPath); | ||
$this->collectionTimeBackendModel->afterSave(); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return [ | ||
PrepareInitialConfig::class, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.