88
99use OC \AppConfig ;
1010use OC \AppFramework \Bootstrap \Coordinator ;
11- use OC \ServerNotAvailableException ;
1211use OCP \Activity \IManager as IActivityManager ;
1312use OCP \App \AppPathNotFoundException ;
1413use OCP \App \Events \AppDisableEvent ;
@@ -251,7 +250,7 @@ public function loadApps(array $types = []): bool {
251250 }
252251 }
253252
254- // prevent app.php from printing output
253+ // prevent app loading from printing output
255254 ob_start ();
256255 foreach ($ apps as $ app ) {
257256 if (!$ this ->isAppLoaded ($ app ) && ($ types === [] || $ this ->isType ($ app , $ types ))) {
@@ -452,43 +451,13 @@ public function loadApp(string $app): void {
452451 // in case someone calls loadApp() directly
453452 \OC_App::registerAutoloading ($ app , $ appPath );
454453
455- /** @var Coordinator $coordinator */
456- $ coordinator = \OC ::$ server ->get (Coordinator::class);
457- $ isBootable = $ coordinator ->isBootable ($ app );
458-
459- $ hasAppPhpFile = is_file ($ appPath . '/appinfo/app.php ' );
460-
461- if ($ isBootable && $ hasAppPhpFile ) {
462- $ this ->logger ->error ('/appinfo/app.php is not loaded when \OCP\AppFramework\Bootstrap\IBootstrap on the application class is used. Migrate everything from app.php to the Application class. ' , [
454+ if (is_file ($ appPath . '/appinfo/app.php ' )) {
455+ $ this ->logger ->error ('/appinfo/app.php is not supported anymore, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead. ' , [
463456 'app ' => $ app ,
464457 ]);
465- } elseif ($ hasAppPhpFile ) {
466- $ eventLogger ->start ("bootstrap:load_app: $ app:app.php " , "Load legacy app.php app $ app " );
467- $ this ->logger ->debug ('/appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead. ' , [
468- 'app ' => $ app ,
469- ]);
470- try {
471- self ::requireAppFile ($ appPath );
472- } catch (\Throwable $ ex ) {
473- if ($ ex instanceof ServerNotAvailableException) {
474- throw $ ex ;
475- }
476- if (!$ this ->isShipped ($ app ) && !$ this ->isType ($ app , ['authentication ' ])) {
477- $ this ->logger ->error ("App $ app threw an error during app.php load and will be disabled: " . $ ex ->getMessage (), [
478- 'exception ' => $ ex ,
479- ]);
480-
481- // Only disable apps which are not shipped and that are not authentication apps
482- $ this ->disableApp ($ app , true );
483- } else {
484- $ this ->logger ->error ("App $ app threw an error during app.php load: " . $ ex ->getMessage (), [
485- 'exception ' => $ ex ,
486- ]);
487- }
488- }
489- $ eventLogger ->end ("bootstrap:load_app: $ app:app.php " );
490458 }
491459
460+ $ coordinator = \OCP \Server::get (Coordinator::class);
492461 $ coordinator ->bootApp ($ app );
493462
494463 $ eventLogger ->start ("bootstrap:load_app: $ app:info " , "Load info.xml for $ app and register any services defined in it " );
@@ -560,6 +529,7 @@ public function loadApp(string $app): void {
560529
561530 $ eventLogger ->end ("bootstrap:load_app: $ app " );
562531 }
532+
563533 /**
564534 * Check if an app is loaded
565535 * @param string $app app id
@@ -569,17 +539,6 @@ public function isAppLoaded(string $app): bool {
569539 return isset ($ this ->loadedApps [$ app ]);
570540 }
571541
572- /**
573- * Load app.php from the given app
574- *
575- * @param string $app app name
576- * @throws \Error
577- */
578- private static function requireAppFile (string $ app ): void {
579- // encapsulated here to avoid variable scope conflicts
580- require_once $ app . '/appinfo/app.php ' ;
581- }
582-
583542 /**
584543 * Enable an app for every user
585544 *
0 commit comments