@@ -50,8 +50,9 @@ protected function configure(): void {
5050 $ this ->addOption ('force-scopes ' , null , InputOption::VALUE_NONE , 'Force new ExApp scopes approval[deprecated] ' );
5151 $ this ->addOption ('wait-finish ' , null , InputOption::VALUE_NONE , 'Wait until finish ' );
5252 $ 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 ' );
5454 $ 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 ' );
5556 }
5657
5758 protected function execute (InputInterface $ input , OutputInterface $ output ): int {
@@ -110,6 +111,15 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
110111 return 1 ;
111112 }
112113
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+
113123 $ daemonConfig = $ this ->daemonConfigService ->getDaemonConfigByName ($ exApp ->getDaemonConfigName ());
114124 if ($ daemonConfig === null ) {
115125 $ this ->logger ->error (sprintf ('Daemon config %s not found. ' , $ exApp ->getDaemonConfigName ()));
@@ -145,7 +155,8 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
145155 $ exApp ->setStatus ($ status );
146156 $ this ->exAppService ->updateExApp ($ exApp , ['status ' ]);
147157
148- if ($ exApp ->getEnabled ()) {
158+ $ wasEnabled = $ exApp ->getEnabled ();
159+ if ($ wasEnabled ) {
149160 if ($ this ->service ->disableExApp ($ exApp )) {
150161 $ this ->logger ->info (sprintf ('ExApp %s successfully disabled. ' , $ appId ));
151162 if ($ outputConsole ) {
@@ -253,6 +264,19 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
253264 if ($ outputConsole ) {
254265 $ output ->writeln (sprintf ('ExApp %s successfully updated. ' , $ appId ));
255266 }
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+
256280 return 0 ;
257281 }
258282}
0 commit comments