8
8
use Magento \MagentoCloud \Shell \ShellInterface ;
9
9
use Magento \MagentoCloud \Process \ProcessInterface ;
10
10
use Magento \MagentoCloud \Config \Shared as SharedConfig ;
11
- use Magento \MagentoCloud \Util \ModuleInformation ;
12
11
use Psr \Log \LoggerInterface ;
13
12
14
13
/**
@@ -26,11 +25,6 @@ class PrepareModuleConfig implements ProcessInterface
26
25
*/
27
26
private $ shell ;
28
27
29
- /**
30
- * @var moduleInformation
31
- */
32
- private $ moduleInformation ;
33
-
34
28
/**
35
29
* @var LoggerInterface
36
30
*/
@@ -39,18 +33,15 @@ class PrepareModuleConfig implements ProcessInterface
39
33
/**
40
34
* @param SharedConfig $sharedConfig
41
35
* @param ShellInterface $shell
42
- * @param moduleInformation $moduleInformation
43
36
* @param LoggerInterface $logger
44
37
*/
45
38
public function __construct (
46
39
SharedConfig $ sharedConfig ,
47
40
ShellInterface $ shell ,
48
- moduleInformation $ moduleInformation ,
49
41
LoggerInterface $ logger
50
42
) {
51
43
$ this ->sharedConfig = $ sharedConfig ;
52
44
$ this ->shell = $ shell ;
53
- $ this ->moduleInformation = $ moduleInformation ;
54
45
$ this ->logger = $ logger ;
55
46
}
56
47
@@ -62,21 +53,16 @@ public function execute()
62
53
$ this ->logger ->info ('Reconciling installed modules with shared config. ' );
63
54
$ moduleConfig = $ this ->sharedConfig ->get ('modules ' );
64
55
65
- if (empty ( $ moduleConfig) ) {
56
+ if (! $ moduleConfig ) {
66
57
$ this ->logger ->info ('Shared config file is missing module section. Updating with all installed modules. ' );
67
58
$ this ->shell ->execute ('php bin/magento module:enable --all ' );
68
- return ;
69
- }
70
-
71
- $ newModules = $ this ->moduleInformation ->getNewModuleNames ();
59
+ $ this ->sharedConfig ->reset ();
72
60
73
- if (empty ($ newModules )) {
74
- $ this ->logger ->info ('All installed modules present in shared config. ' );
75
61
return ;
76
62
}
77
63
78
- $ this ->logger -> info ( ' Enabling newly installed modules not found in shared config. ' );
79
- $ enableModules = join ( " " , $ newModules );
80
- $ this ->shell -> execute ( " php bin/magento module:enable $ enableModules " );
64
+ $ actualConfig = $ this ->sharedConfig -> read ( );
65
+ $ this -> shell -> execute ( ' php bin/magento module:enable --all ' );
66
+ $ this ->sharedConfig -> update ( $ actualConfig );
81
67
}
82
68
}
0 commit comments