]> source.dussan.org Git - nextcloud-server.git/commitdiff
only boot apps once 22133/head
authorRobin Appelman <robin@icewind.nl>
Thu, 6 Aug 2020 14:48:06 +0000 (16:48 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 7 Aug 2020 09:04:47 +0000 (11:04 +0200)
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 <robin@icewind.nl>
lib/private/AppFramework/Bootstrap/Coordinator.php

index 358e71d78541de1bc5d766bd5f3db32a80134ac2..e293ef2998e9d93dc37da8cdb103719f1b4dba09 100644 (file)
@@ -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)) {