Skip to content

Commit a1587ae

Browse files
authored
Merge pull request #5775 from magento-trigger/MC-34416
[trigger] MC-34416: Error in the CLI during upgrade
2 parents 6c9cd23 + 79c8f5e commit a1587ae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

setup/src/Magento/Setup/Console/Command/UpgradeCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\App\State as AppState;
1010
use Magento\Framework\App\DeploymentConfig;
1111
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\Config\CacheInterface;
1213
use Magento\Framework\Setup\ConsoleLogger;
1314
use Magento\Framework\Setup\Declaration\Schema\DryRunLogger;
1415
use Magento\Framework\Setup\Declaration\Schema\OperationsExecutor;
@@ -52,22 +53,30 @@ class UpgradeCommand extends AbstractSetupCommand
5253
*/
5354
private $searchConfigFactory;
5455

56+
/*
57+
* @var CacheInterface
58+
*/
59+
private $cache;
60+
5561
/**
5662
* @param InstallerFactory $installerFactory
5763
* @param SearchConfigFactory $searchConfigFactory
5864
* @param DeploymentConfig $deploymentConfig
5965
* @param AppState|null $appState
66+
* @param CacheInterface|null $cache
6067
*/
6168
public function __construct(
6269
InstallerFactory $installerFactory,
6370
SearchConfigFactory $searchConfigFactory,
6471
DeploymentConfig $deploymentConfig = null,
65-
AppState $appState = null
72+
AppState $appState = null,
73+
CacheInterface $cache = null
6674
) {
6775
$this->installerFactory = $installerFactory;
6876
$this->searchConfigFactory = $searchConfigFactory;
6977
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
7078
$this->appState = $appState ?: ObjectManager::getInstance()->get(AppState::class);
79+
$this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class);
7180
parent::__construct();
7281
}
7382

@@ -129,6 +138,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
129138
$installer = $this->installerFactory->create(new ConsoleLogger($output));
130139
$installer->updateModulesSequence($keepGenerated);
131140
$searchConfig = $this->searchConfigFactory->create();
141+
$this->cache->clean();
132142
$searchConfig->validateSearchEngine();
133143
$installer->installSchema($request);
134144
$installer->installDataFixtures($request);

0 commit comments

Comments
 (0)