Merge pull request #23948 from nextcloud/backport/23940/stable20

[stable20] Skip already loaded apps in loadApps
This commit is contained in:
Roeland Jago Douma 2020-11-07 07:59:52 +01:00 committed by GitHub
commit a5c6abc93a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ class OC_App {
* @return bool * @return bool
*/ */
public static function isAppLoaded(string $app): 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 // prevent app.php from printing output
ob_start(); ob_start();
foreach ($apps as $app) { 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); self::loadApp($app);
} }
} }
@ -143,7 +143,7 @@ class OC_App {
* @throws Exception * @throws Exception
*/ */
public static function loadApp(string $app) { public static function loadApp(string $app) {
self::$loadedApps[] = $app; self::$loadedApps[$app] = true;
$appPath = self::getAppPath($app); $appPath = self::getAppPath($app);
if ($appPath === false) { if ($appPath === false) {
return; return;