@@ -50,8 +50,9 @@ protected function configure(): void {
50
50
$ this ->addOption ('force-scopes ' , null , InputOption::VALUE_NONE , 'Force new ExApp scopes approval[deprecated] ' );
51
51
$ this ->addOption ('wait-finish ' , null , InputOption::VALUE_NONE , 'Wait until finish ' );
52
52
$ this ->addOption ('silent ' , null , InputOption::VALUE_NONE , 'Do not print to console ' );
53
- $ this ->addOption ('all ' , null , InputOption::VALUE_NONE , 'Update all updatable apps ' );
53
+ $ this ->addOption ('all ' , null , InputOption::VALUE_NONE , 'Updates all enabled and updatable apps ' );
54
54
$ this ->addOption ('showonly ' , null , InputOption::VALUE_NONE , 'Additional flag for "--all" to only show all updatable apps ' );
55
+ $ this ->addOption ('include-disabled ' , null , InputOption::VALUE_NONE , 'Additional flag for "--all" to also update disabled apps ' );
55
56
}
56
57
57
58
protected function execute (InputInterface $ input , OutputInterface $ output ): int {
@@ -110,6 +111,15 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
110
111
return 1 ;
111
112
}
112
113
114
+ $ includeDisabledApps = $ input ->getOption ('include-disabled ' );
115
+ if ($ input ->getOption ('all ' ) && !$ exApp ->getEnabled () && !$ includeDisabledApps ) {
116
+ $ this ->logger ->info (sprintf ('ExApp %s is disabled. Update skipped (use --include-disabled to update disabled apps). ' , $ appId ));
117
+ if ($ outputConsole ) {
118
+ $ output ->writeln (sprintf ('ExApp %s is disabled. Update skipped (use --include-disabled to update disabled apps). ' , $ appId ));
119
+ }
120
+ return 0 ;
121
+ }
122
+
113
123
$ daemonConfig = $ this ->daemonConfigService ->getDaemonConfigByName ($ exApp ->getDaemonConfigName ());
114
124
if ($ daemonConfig === null ) {
115
125
$ this ->logger ->error (sprintf ('Daemon config %s not found. ' , $ exApp ->getDaemonConfigName ()));
@@ -145,7 +155,8 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
145
155
$ exApp ->setStatus ($ status );
146
156
$ this ->exAppService ->updateExApp ($ exApp , ['status ' ]);
147
157
148
- if ($ exApp ->getEnabled ()) {
158
+ $ wasEnabled = $ exApp ->getEnabled ();
159
+ if ($ wasEnabled ) {
149
160
if ($ this ->service ->disableExApp ($ exApp )) {
150
161
$ this ->logger ->info (sprintf ('ExApp %s successfully disabled. ' , $ appId ));
151
162
if ($ outputConsole ) {
@@ -253,6 +264,19 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
253
264
if ($ outputConsole ) {
254
265
$ output ->writeln (sprintf ('ExApp %s successfully updated. ' , $ appId ));
255
266
}
267
+
268
+ if ($ includeDisabledApps ) {
269
+ $ exApp = $ this ->exAppService ->getExApp ($ appId );
270
+ if (!$ wasEnabled && $ exApp ->getEnabled ()) {
271
+ if ($ this ->service ->disableExApp ($ exApp )) {
272
+ $ this ->logger ->info (sprintf ('ExApp %s successfully disabled after update. ' , $ appId ));
273
+ if ($ outputConsole ) {
274
+ $ output ->writeln (sprintf ('ExApp %s successfully disabled after update. ' , $ appId ));
275
+ }
276
+ }
277
+ }
278
+ }
279
+
256
280
return 0 ;
257
281
}
258
282
}
0 commit comments