From 22c0ee9af128ed05e41b6968f6f11ef806666d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 26 Jun 2017 14:03:44 +0200 Subject: [PATCH] [stable10] load app type only once --- lib/private/legacy/app.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index f43cf87322e3..287355a7a238 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -63,6 +63,7 @@ class OC_App { static private $appInfo = []; static private $appTypes = []; static private $loadedApps = []; + static private $loadedTypes = []; static private $altLogin = []; const officialApp = 200; const approvedApp = 100; @@ -100,6 +101,9 @@ public static function isAppLoaded($app) { * if $types is set, only apps of those types will be loaded */ public static function loadApps($types = null) { + if (is_array($types) && !array_diff($types, self::$loadedTypes)) { + return true; + } if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } @@ -108,6 +112,9 @@ public static function loadApps($types = null) { // Add each apps' folder as allowed class path foreach($apps as $app) { + if (self::isAppLoaded($app)) { + continue; + } $path = self::getAppPath($app); if($path !== false) { self::registerAutoloading($app, $path); @@ -132,6 +139,9 @@ public static function loadApps($types = null) { } } } + if (is_array($types)) { + self::$loadedTypes = array_merge(self::$loadedTypes, $types); + } \OC_Hook::emit('OC_App', 'loadedApps'); return true;