Skip to content

Commit 6013060

Browse files
committed
Merge remote-tracking branch 'ogresCE/MAGETWO-38561-exception-static-deploy' into PR_Branch
2 parents a7806f2 + f915940 commit 6013060

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\App\View\Deployment\Version;
1111
use Magento\Framework\App\View\Asset\Publisher;
1212
use Magento\Framework\App\Utility\Files;
13+
use Magento\Framework\Config\Theme;
1314
use Magento\Framework\ObjectManagerInterface;
1415
use Magento\Framework\Translate\Js\Config as JsTranslationConfig;
1516
use Symfony\Component\Console\Output\OutputInterface;
@@ -95,6 +96,7 @@ public function __construct(
9596
$this->isDryRun = $isDryRun;
9697
$this->minifyService = $minifyService;
9798
$this->jsTranslationConfig = $jsTranslationConfig;
99+
$this->parentTheme = [];
98100
}
99101

100102
/**
@@ -125,8 +127,14 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales)
125127
$this->count = 0;
126128
$this->errorCount = 0;
127129
foreach ($appFiles as $info) {
128-
list($fileArea, , , $module, $filePath) = $info;
129-
if ($fileArea == $area || $fileArea == 'base') {
130+
list($fileArea, $fileTheme, , $module, $filePath) = $info;
131+
if (($fileArea == $area || $fileArea == 'base') &&
132+
($fileTheme == '' || $fileTheme == $themePath ||
133+
in_array(
134+
$fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme,
135+
$this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath)
136+
))
137+
) {
130138
$this->deployFile($filePath, $area, $themePath, $locale, $module);
131139
}
132140
}
@@ -302,6 +310,25 @@ private function deployFile($filePath, $area, $themePath, $locale, $module)
302310
}
303311
}
304312

313+
/**
314+
* Find ancestor themes' full paths
315+
*
316+
* @param string $themeFullPath
317+
* @return string[]
318+
*/
319+
private function findAncestors($themeFullPath)
320+
{
321+
/** @var \Magento\Framework\View\Design\Theme\ListInterface $themeCollection */
322+
$themeCollection = $this->objectManager->get('Magento\Framework\View\Design\Theme\ListInterface');
323+
$theme = $themeCollection->getThemeByFullPath($themeFullPath);
324+
$ancestors = $theme->getInheritedThemes();
325+
$ancestorThemeFullPath = [];
326+
foreach ($ancestors as $ancestor) {
327+
$ancestorThemeFullPath[] = $ancestor->getFullPath();
328+
}
329+
return $ancestorThemeFullPath;
330+
}
331+
305332
/**
306333
* Verbose log
307334
*

0 commit comments

Comments
 (0)