From 70fd3a267f08a5f8bd8c50265a3469784ec9aca7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 3 Feb 2015 14:13:44 +0100 Subject: Cache app versions --- lib/private/app.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/private/app.php') diff --git a/lib/private/app.php b/lib/private/app.php index 3a1f731d621..bd58493a4ce 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -34,6 +34,7 @@ use OC\App\Platform; * upgrading and removing apps. */ class OC_App { + static private $appVersion = []; static private $settingsForms = array(); static private $adminForms = array(); static private $personalForms = array(); @@ -600,8 +601,11 @@ class OC_App { * @return string */ public static function getAppVersion($appId) { - $file = self::getAppPath($appId); - return ($file !== false) ? self::getAppVersionByPath($file) : '0'; + if (!isset(self::$appVersion[$appId])) { + $file = self::getAppPath($appId); + self::$appVersion[$appId] = ($file !== false) ? self::getAppVersionByPath($file) : '0'; + } + return self::$appVersion[$appId]; } /** -- cgit v1.2.3 From 6f118d7f8db9a2ade4fc29f2900147bf1e914f59 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 3 Feb 2015 15:23:51 +0100 Subject: clear app version cache on upgrade --- lib/private/app.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/private/app.php') diff --git a/lib/private/app.php b/lib/private/app.php index bd58493a4ce..12b26244f3f 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -1159,6 +1159,7 @@ class OC_App { if (file_exists(self::getAppPath($appId) . '/appinfo/database.xml')) { OC_DB::updateDbFromStructure(self::getAppPath($appId) . '/appinfo/database.xml'); } + unset(self::$appVersion[$appId]); if (!self::isEnabled($appId)) { return false; } -- cgit v1.2.3