From: Robin Appelman Date: Thu, 6 Aug 2020 14:48:06 +0000 (+0200) Subject: only boot apps once X-Git-Tag: v20.0.0beta1~115^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F22133%2Fhead;p=nextcloud-server.git only boot apps once in some cases `loadApp` is called more then once which is currently causing apps to be "booted" multiple times which can lead to unexepected behaviour with things like registering hooks Signed-off-by: Robin Appelman --- diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php index 358e71d7854..e293ef2998e 100644 --- a/lib/private/AppFramework/Bootstrap/Coordinator.php +++ b/lib/private/AppFramework/Bootstrap/Coordinator.php @@ -60,6 +60,9 @@ class Coordinator { /** @var RegistrationContext|null */ private $registrationContext; + /** @var string[] */ + private $bootedApps = []; + public function __construct(IServerContainer $container, Registry $registry, IManager $dashboardManager, @@ -134,6 +137,11 @@ class Coordinator { } public function bootApp(string $appId): void { + if (isset($this->bootedApps[$appId])) { + return; + } + $this->bootedApps[$appId] = true; + $appNameSpace = App::buildAppNamespace($appId); $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; if (!class_exists($applicationClassName)) {