Skip to content

Commit 79a93b1

Browse files
author
Igor Melnikov
committed
MAGETWO-58017: [GITHUB] Error creating configurable products in 2.1.1 #6424
Enable static content signing by default
1 parent 4c4a4a2 commit 79a93b1

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
402402
if ($this->isCanBeParalleled()) {
403403
return $this->runProcessesInParallel($deployer, $deployableAreaThemeMap, $deployableLanguages);
404404
} else {
405-
return $this->deploy($deployer, $deployableLanguages, $deployableAreaThemeMap);
405+
return $deployer->deploy(
406+
$this->objectManagerFactory,
407+
$deployableLanguages,
408+
$deployableAreaThemeMap
409+
);
406410
}
407411
}
408412

@@ -465,21 +469,6 @@ private function prepareDeployableEntities($filesUtil)
465469
return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes];
466470
}
467471

468-
/**
469-
* @param \Magento\Deploy\Model\Deployer $deployer
470-
* @param array $deployableLanguages
471-
* @param array $deployableAreaThemeMap
472-
* @return int
473-
*/
474-
private function deploy($deployer, $deployableLanguages, $deployableAreaThemeMap)
475-
{
476-
return $deployer->deploy(
477-
$this->objectManagerFactory,
478-
$deployableLanguages,
479-
$deployableAreaThemeMap
480-
);
481-
}
482-
483472
/**
484473
* @param \Magento\Deploy\Model\Deployer $deployer
485474
* @param array $deployableAreaThemeMap
@@ -493,11 +482,23 @@ private function runProcessesInParallel($deployer, $deployableAreaThemeMap, $dep
493482
$processManager = $this->objectManager->create(ProcessManager::class);
494483
$processNumber = 0;
495484
$processQueue = [];
485+
$staticContentVersion = time();
496486
foreach ($deployableAreaThemeMap as $area => &$themes) {
497487
foreach ($themes as $theme) {
498488
foreach ($deployableLanguages as $lang) {
499-
$deployerFunc = function (Process $process) use ($area, $theme, $lang, $deployer) {
500-
return $this->deploy($deployer, [$lang], [$area => [$theme]]);
489+
$deployerFunc = function (Process $process) use (
490+
$area,
491+
$theme,
492+
$lang,
493+
$deployer,
494+
$staticContentVersion
495+
) {
496+
return $deployer->deploy(
497+
$this->objectManagerFactory,
498+
[$lang],
499+
[$area => [$theme]],
500+
$staticContentVersion
501+
);
501502
};
502503
if ($processNumber >= $this->getProcessesAmount()) {
503504
$processQueue[] = $deployerFunc;

app/code/Magento/Deploy/Model/Deployer.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,18 @@ private function checkSkip($filePath)
200200
* @param ObjectManagerFactory $omFactory
201201
* @param array $locales
202202
* @param array $deployableAreaThemeMap
203+
* @param int $staticContentVersion
203204
* @return int
204205
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
205206
* @SuppressWarnings(PHPMD.NPathComplexity)
206207
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
207208
*/
208-
public function deploy(ObjectManagerFactory $omFactory, array $locales, array $deployableAreaThemeMap = [])
209-
{
209+
public function deploy(
210+
ObjectManagerFactory $omFactory,
211+
array $locales,
212+
array $deployableAreaThemeMap = [],
213+
$staticContentVersion = null
214+
) {
210215
$this->omFactory = $omFactory;
211216

212217
if ($this->getOption(Options::DRY_RUN)) {
@@ -215,6 +220,11 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d
215220
$libFiles = $this->filesUtil->getStaticLibraryFiles();
216221
$appFiles = $this->filesUtil->getStaticPreProcessingFiles();
217222

223+
$staticContentVersion = $staticContentVersion ?: time();
224+
if (!$this->getOption(Options::DRY_RUN)) {
225+
$this->versionStorage->save($staticContentVersion);
226+
}
227+
218228
foreach ($deployableAreaThemeMap as $area => $themes) {
219229
$this->emulateApplicationArea($area);
220230
foreach ($locales as $locale) {
@@ -319,11 +329,7 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d
319329
$this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n");
320330
}
321331

322-
$version = (new \DateTime())->getTimestamp();
323-
$this->output->writeln("New version of deployed files: {$version}");
324-
if (!$this->getOption(Options::DRY_RUN)) {
325-
$this->versionStorage->save($version);
326-
}
332+
$this->output->writeln("New version of deployed files: {$staticContentVersion}");
327333

328334
if ($this->errorCount > 0) {
329335
// we must have an exit code higher than zero to indicate something was wrong

0 commit comments

Comments
 (0)