diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-11-06 14:26:42 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-11-06 14:56:06 +0100 |
commit | 0dece786172f7d0ee343c4d92343341378fb9031 (patch) | |
tree | 3d257c3e0908c3be388090fb80cf520242080dcd /lib | |
parent | 3f4fb9dc89016e701678d6310281705a92fbe3e6 (diff) | |
download | nextcloud-server-0dece786172f7d0ee343c4d92343341378fb9031.tar.gz nextcloud-server-0dece786172f7d0ee343c4d92343341378fb9031.zip |
Skip already loaded apps in loadApps
Otherwise you might end up calling a lot of functions unneeded.
And while the individual calls are cheap if you multiply them by 20k
they still get somewhat expensive.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/legacy/OC_App.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index d2f8e536005..941cd25397d 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -94,7 +94,7 @@ class OC_App { * @return bool */ public static function isAppLoaded(string $app): bool { - return in_array($app, self::$loadedApps, true); + return isset(self::$loadedApps[$app]); } /** @@ -127,7 +127,7 @@ class OC_App { // prevent app.php from printing output ob_start(); foreach ($apps as $app) { - if (($types === [] or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { + if (!isset(self::$loadedApps[$app]) && ($types === [] || self::isType($app, $types))) { self::loadApp($app); } } @@ -143,7 +143,7 @@ class OC_App { * @throws Exception */ public static function loadApp(string $app) { - self::$loadedApps[] = $app; + self::$loadedApps[$app] = true; $appPath = self::getAppPath($app); if ($appPath === false) { return; |