From b5694103f0774ad8cc11003146225d43f0769091 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Tue, 9 Apr 2019 20:38:45 +0300 Subject: [PATCH 1/2] Fix array merge in loop to speed up static content deploy --- .../Magento/Deploy/Package/Processor/PreProcessor/Css.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php index b3461e3ab4a22..ffd6b0bbd8df7 100644 --- a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php +++ b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php @@ -180,11 +180,13 @@ private function buildMap($packagePath, $filePath, $fullPath) */ private function collectFileMap($fileName) { - $result = isset($this->map[$fileName]) ? $this->map[$fileName] : []; + $result = [$this->map[$fileName] ?? []]; + foreach ($result as $path) { - $result = array_merge($result, $this->collectFileMap($path)); + $result[] = $this->collectFileMap($path); } - return array_unique($result); + + return array_unique(array_merge(...$result)); } /** From da692408dc993419966948e4c890cf278088ab28 Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Tue, 23 Apr 2019 13:32:54 +0300 Subject: [PATCH 2/2] Fix static test. --- .../Magento/Deploy/Package/Processor/PreProcessor/Css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php index ffd6b0bbd8df7..fd06e20c5c7d7 100644 --- a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php +++ b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Package\Processor\PreProcessor; use Magento\Deploy\Console\DeployStaticOptions; @@ -92,8 +93,7 @@ public function process(Package $package, array $options) } /** - * Checks if there are imports of CSS files or images within the given CSS file - * which exists in the current package + * Checks if there are imports of CSS files or images within the given CSS file which exists in the current package. * * @param PackageFile $parentFile * @param Package $package