summaryrefslogtreecommitdiffstats
path: root/lib/public/util.php
diff options
context:
space:
mode:
authorIndividual IT Services <info@individual-it.net>2015-09-10 10:05:07 +0545
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-29 15:34:42 +0200
commitfbe43e6a267389aebacd08b0d3965ee29f7b0c4c (patch)
tree06a4ba555f1b10aabe70a8d76b24a7936c43229f /lib/public/util.php
parent1abd4f52bb5a2300a279d8b9eb0d15d22721b575 (diff)
downloadnextcloud-server-fbe43e6a267389aebacd08b0d3965ee29f7b0c4c.tar.gz
nextcloud-server-fbe43e6a267389aebacd08b0d3965ee29f7b0c4c.zip
cache result of \OCP\Util::needUpgrade()
reduce calls of \OCP\Util::needUpgrade() where \OCP\Util::needUpgrade() is called we can call as well self::checkUpgrade and use the cached result In line 877 the call way unnecessary anyway because of the first part of the if statement move caching to \OCP\Util::needUpgrade renaming variable fixing testNeedUpgradeCore() cache result of checkUpgrade() in self::$needUpgrade reduce calls of \OCP\Util::needUpgrade() where \OCP\Util::needUpgrade() is called we can call as well self::checkUpgrade and use the cached result In line 877 the call way unnecessary anyway because of the first part of the if statement move caching to \OCP\Util::needUpgrade renaming variable fixing testNeedUpgradeCore() fix typo in variable name deleting tabs
Diffstat (limited to 'lib/public/util.php')
-rw-r--r--lib/public/util.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/public/util.php b/lib/public/util.php
index 652df5192cf..1ba091d1952 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -654,6 +654,7 @@ class Util {
return \OC_Util::isDefaultExpireDateEnforced();
}
+ protected static $needUpgradeCache = null;
/**
* Checks whether the current version needs upgrade.
@@ -662,6 +663,9 @@ class Util {
* @since 7.0.0
*/
public static function needUpgrade() {
- return \OC_Util::needUpgrade(\OC::$server->getConfig());
+ if (!isset(self::$needUpgradeCache)) {
+ self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getConfig());
+ }
+ return self::$needUpgradeCache;
}
}