]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't break OCC if an app is breaking in it's Application class 26879/head
authorJoas Schilling <coding@schilljs.com>
Thu, 6 May 2021 12:46:11 +0000 (14:46 +0200)
committerJoas Schilling <coding@schilljs.com>
Thu, 6 May 2021 12:46:11 +0000 (14:46 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/AppFramework/Bootstrap/Coordinator.php
lib/private/legacy/OC_App.php

index 06a17e5242b576309f8c4605e3e32851e4f0fb9f..80ef24b5204323810c3f46fc1ee44eddff5e3127 100644 (file)
@@ -113,22 +113,24 @@ class Coordinator {
                         */
                        $appNameSpace = App::buildAppNamespace($appId);
                        $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
-                       if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
-                               try {
-                                       /** @var IBootstrap|App $application */
-                                       $apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
-                               } catch (QueryException $e) {
-                                       // Weird, but ok
-                                       continue;
-                               }
-                               try {
+                       try {
+                               if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
+                                       try {
+                                               /** @var IBootstrap|App $application */
+                                               $apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
+                                       } catch (QueryException $e) {
+                                               // Weird, but ok
+                                               continue;
+                                       }
                                        $application->register($this->registrationContext->for($appId));
-                               } catch (Throwable $e) {
-                                       $this->logger->logException($e, [
-                                               'message' => 'Error during app service registration: ' . $e->getMessage(),
-                                               'level' => ILogger::FATAL,
-                                       ]);
                                }
+                       } catch (Throwable $e) {
+                               $this->logger->logException($e, [
+                                       'message' => 'Error during app service registration: ' . $e->getMessage(),
+                                       'level' => ILogger::FATAL,
+                                       'app' => $appId,
+                               ]);
+                               continue;
                        }
                }
 
index a64b13f1e2c8bc3faf056bad62831be816d03c7d..6fecddba54017701ab6790f01bed56b2550991f5 100644 (file)
@@ -134,7 +134,15 @@ class OC_App {
                ob_start();
                foreach ($apps as $app) {
                        if (!isset(self::$loadedApps[$app]) && ($types === [] || self::isType($app, $types))) {
-                               self::loadApp($app);
+                               try {
+                                       self::loadApp($app);
+                               } catch (\Throwable $e) {
+                                       \OC::$server->getLogger()->logException($e, [
+                                               'message' => 'Error during app loading: ' . $e->getMessage(),
+                                               'level' => ILogger::FATAL,
+                                               'app' => $app,
+                                       ]);
+                               }
                        }
                }
                ob_end_clean();