Merge pull request #26954 from nextcloud/backport/26879/stable20

[stable20]  Don't break OCC if an app is breaking in it's Application class
This commit is contained in:
Morris Jobke 2021-05-18 09:32:22 +02:00 committed by GitHub
commit da32428c3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 15 deletions

View File

@ -105,6 +105,7 @@ class Coordinator {
*/
$appNameSpace = App::buildAppNamespace($appId);
$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
try {
if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
try {
/** @var IBootstrap|App $application */
@ -113,14 +114,15 @@ class Coordinator {
// Weird, but ok
continue;
}
try {
$application->register($this->registrationContext->for($appId));
}
} catch (Throwable $e) {
$this->logger->logException($e, [
'message' => 'Error during app service registration: ' . $e->getMessage(),
'level' => ILogger::FATAL,
'app' => $appId,
]);
}
continue;
}
}

View File

@ -128,7 +128,15 @@ class OC_App {
ob_start();
foreach ($apps as $app) {
if (!isset(self::$loadedApps[$app]) && ($types === [] || self::isType($app, $types))) {
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();