Skip to content

Commit d8c0afd

Browse files
confirm changes for only upgrade command
1 parent ec9462e commit d8c0afd

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
120120
$installer = $this->installerFactory->create(new ConsoleLogger($output));
121121
$installer->updateModulesSequence($keepGenerated);
122122
$installer->installSchema($request);
123-
$installer->installDataFixtures($request);
123+
$installer->installDataFixtures($request, true);
124124

125125
if ($this->deploymentConfig->isAvailable()) {
126126
$importConfigCommand = $this->getApplication()->find(ConfigImportCommand::COMMAND_NAME);

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -867,22 +867,24 @@ private function convertationOfOldScriptsIsAllowed(array $request)
867867
* @param array $request
868868
* @return void
869869
*/
870-
public function installDataFixtures(array $request = [])
870+
public function installDataFixtures(array $request = [], $keepCacheStatuses = false)
871871
{
872872
$frontendCaches = [
873873
PageCache::TYPE_IDENTIFIER,
874874
BlockCache::TYPE_IDENTIFIER,
875875
LayoutCache::TYPE_IDENTIFIER,
876876
];
877877

878-
$cacheManager = $this->objectManagerProvider->get()->create(\Magento\Framework\App\Cache\Manager::class);
879-
$disabledCaches = array_filter(
880-
$cacheManager->getStatus(),
881-
function ($value, string $key) use ($frontendCaches) {
882-
return $value == false && in_array($key, $frontendCaches);
883-
},
884-
ARRAY_FILTER_USE_BOTH
885-
);
878+
if($keepCacheStatuses){
879+
$cacheManager = $this->objectManagerProvider->get()->create(\Magento\Framework\App\Cache\Manager::class);
880+
$disabledCaches = array_filter(
881+
$cacheManager->getStatus(),
882+
function ($value, string $key) use ($frontendCaches) {
883+
return $value == false && in_array($key, $frontendCaches);
884+
},
885+
ARRAY_FILTER_USE_BOTH
886+
);
887+
}
886888

887889
/** @var \Magento\Framework\Registry $registry */
888890
$registry = $this->objectManagerProvider->get()->get(\Magento\Framework\Registry::class);
@@ -899,8 +901,10 @@ function ($value, string $key) use ($frontendCaches) {
899901
$this->handleDBSchemaData($setup, 'data', $request);
900902
$this->log->log('Enabling caches:');
901903
$this->updateCaches(true, $frontendCaches);
902-
$this->log->log('Return disabled caches back to their old state:');
903-
$this->updateCaches(false, array_keys($disabledCaches));
904+
if($keepCacheStatuses && !empty($disabledCaches)){
905+
$this->log->log('Disabling pre-disabled caches:');
906+
$this->updateCaches(false, array_keys($disabledCaches));
907+
}
904908

905909
$registry->unregister('setup-mode-enabled');
906910
}

0 commit comments

Comments
 (0)