summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-05-12 09:40:01 +0200
committerGitHub <noreply@github.com>2021-05-12 09:40:01 +0200
commitdd014059d7d1ddd769c80ed1d290e36b1d8c02b2 (patch)
tree4c48169bb59b44a10e1cbdc36de2e9b17a0eb418 /lib
parent3bcc23ba2c6618eb5714c6bf80875e43157c0653 (diff)
parent3d9abee6f0d03386e5764187c5dd5bf6df7a497a (diff)
downloadnextcloud-server-dd014059d7d1ddd769c80ed1d290e36b1d8c02b2.tar.gz
nextcloud-server-dd014059d7d1ddd769c80ed1d290e36b1d8c02b2.zip
Merge pull request #26879 from nextcloud/backport/26878/stable21
[stable21] Don't break OCC if an app is breaking in it's Application class
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Bootstrap/Coordinator.php30
-rw-r--r--lib/private/legacy/OC_App.php10
2 files changed, 25 insertions, 15 deletions
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php
index 06a17e5242b..80ef24b5204 100644
--- a/lib/private/AppFramework/Bootstrap/Coordinator.php
+++ b/lib/private/AppFramework/Bootstrap/Coordinator.php
@@ -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;
}
}
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index a64b13f1e2c..6fecddba540 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -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();