6
6
7
7
namespace Magento \Setup \Model ;
8
8
9
- use Magento \Framework \App \Filesystem \DirectoryList ;
10
9
use Magento \Framework \App \ObjectManagerFactory ;
11
10
use Magento \Framework \App \View \Deployment \Version ;
12
11
use Magento \Framework \App \View \Asset \Publisher ;
13
12
use Magento \Framework \App \Utility \Files ;
14
13
use Magento \Framework \Config \Theme ;
15
- use Magento \Framework \Filesystem ;
16
14
use Magento \Framework \ObjectManagerInterface ;
17
15
use Magento \Framework \Translate \Js \Config as JsTranslationConfig ;
18
16
use Symfony \Component \Console \Output \OutputInterface ;
24
22
*/
25
23
class Deployer
26
24
{
27
- /**
28
- * @var Filesystem
29
- */
30
- private $ filesystem ;
31
-
32
25
/** @var Files */
33
26
private $ filesUtil ;
34
27
@@ -78,14 +71,8 @@ class Deployer
78
71
*/
79
72
protected $ jsTranslationConfig ;
80
73
81
- /**
82
- * @var \Magento\Framework\View\Design\ThemeInterface[]
83
- */
84
- private $ parentTheme ;
85
-
86
74
/**
87
75
* @param Files $filesUtil
88
- * @param Filesystem $filesystem
89
76
* @param OutputInterface $output
90
77
* @param Version\StorageInterface $versionStorage
91
78
* @param \Magento\Framework\Stdlib\DateTime $dateTime
@@ -95,15 +82,13 @@ class Deployer
95
82
*/
96
83
public function __construct (
97
84
Files $ filesUtil ,
98
- Filesystem $ filesystem ,
99
85
OutputInterface $ output ,
100
86
Version \StorageInterface $ versionStorage ,
101
87
\Magento \Framework \Stdlib \DateTime $ dateTime ,
102
88
\Magento \Framework \View \Asset \MinifyService $ minifyService ,
103
89
JsTranslationConfig $ jsTranslationConfig ,
104
90
$ isDryRun = false
105
91
) {
106
- $ this ->filesystem = $ filesystem ;
107
92
$ this ->filesUtil = $ filesUtil ;
108
93
$ this ->output = $ output ;
109
94
$ this ->versionStorage = $ versionStorage ;
@@ -326,36 +311,22 @@ private function deployFile($filePath, $area, $themePath, $locale, $module)
326
311
}
327
312
328
313
/**
329
- * Find ancestor themes
314
+ * Find ancestor themes' full paths
330
315
*
331
316
* @param string $themeFullPath
332
317
* @return string[]
333
318
*/
334
319
private function findAncestors ($ themeFullPath )
335
320
{
336
- $ ancestors = [];
337
- if (!isset ($ this ->parentTheme [$ themeFullPath ])) {
338
- /** @var \Magento\Framework\View\Design\Theme\ListInterface $themeCollection */
339
- $ themeCollection = $ this ->objectManager ->get ('Magento\Framework\View\Design\Theme\ListInterface ' );
340
- $ theme = $ themeCollection ->getThemeByFullPath ($ themeFullPath );
341
- $ parentTheme = $ theme ->getParentTheme ();
342
- if ($ parentTheme ) {
343
- $ this ->parentTheme [$ themeFullPath ] = $ parentTheme ;
344
- $ ancestors [] = $ parentTheme ->getFullPath ();
345
- $ ancestors = array_merge (
346
- $ ancestors ,
347
- $ this ->findAncestors ($ parentTheme ->getFullPath ())
348
- );
349
- }
350
- } else {
351
- $ parentTheme = $ this ->parentTheme [$ themeFullPath ];
352
- $ ancestors [] = $ parentTheme ->getFullPath ();
353
- $ ancestors = array_merge (
354
- $ ancestors ,
355
- $ this ->findAncestors ($ parentTheme ->getFullPath ())
356
- );
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 ();
357
328
}
358
- return $ ancestors ;
329
+ return $ ancestorThemeFullPath ;
359
330
}
360
331
361
332
/**
0 commit comments