From 8b41689fe6efb6f297a4287c62079336272561a6 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 23 Jun 2014 13:55:21 +0200 Subject: [PATCH 1/2] Only cache enabled apps when logged in --- lib/private/app.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/app.php b/lib/private/app.php index a62623905ff..dc058cadc90 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -174,6 +174,7 @@ class OC_App { } $appConfig = \OC::$server->getAppConfig(); $appStatus = $appConfig->getValues(false, 'enabled'); + $user = \OC_User::getUser(); foreach ($appStatus as $app => $enabled) { if ($app === 'files') { continue; @@ -181,7 +182,6 @@ class OC_App { if ($enabled === 'yes') { $apps[] = $app; } else if ($enabled !== 'no') { - $user = \OC_User::getUser(); $groups = json_decode($enabled); if (is_array($groups)) { foreach ($groups as $group) { @@ -195,7 +195,9 @@ class OC_App { } sort($apps); array_unshift($apps, 'files'); - self::$enabledAppsCache = $apps; + if ($user) { + self::$enabledAppsCache = $apps; + } return $apps; } From 2547945779a9ef907cf1db6d95c345f0f6177788 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 23 Jun 2014 15:14:35 +0200 Subject: [PATCH 2/2] Add comment --- lib/private/app.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/app.php b/lib/private/app.php index dc058cadc90..01597b37e77 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -195,6 +195,9 @@ class OC_App { } sort($apps); array_unshift($apps, 'files'); + // Only cache the app list, when the user is logged in. + // Otherwise we cache the list with disabled apps, although + // the apps are enabled for the user after he logged in. if ($user) { self::$enabledAppsCache = $apps; }