From d8637c62e0b77cc597c9e11e4ea2bcbdd5c74646 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Sat, 7 Nov 2020 17:24:41 +0100 Subject: [PATCH] Reduce the getAppPath and autoloader calls The getAppPath will always return the same data for the same appId. It is actually already cached. However we do some cleanup of the appId (again). Same for the autoloading it is actually already checked. This just removes the unneeded calls. Which can add up if you have a lot of incomming shares. Signed-off-by: Roeland Jago Douma --- lib/private/legacy/OC_App.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 941cd25397..34d5d9ffe7 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -118,9 +118,12 @@ class OC_App { // Add each apps' folder as allowed class path foreach ($apps as $app) { - $path = self::getAppPath($app); - if ($path !== false) { - self::registerAutoloading($app, $path); + // If the app is already loaded then autoloading it makes no sense + if (!isset(self::$loadedApps[$app])) { + $path = self::getAppPath($app); + if ($path !== false) { + self::registerAutoloading($app, $path); + } } }