summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-27 12:48:42 -0800
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-27 12:48:42 -0800
commit9508a58c79a175cabcf46b5014b34730707e4fc0 (patch)
tree1d0f73e186b6b8665fbf67cb5cee594a6d257b11 /lib/db.php
parenta8bab023b2095b5b78c05b1ebadb73bb46459509 (diff)
parent47b899e0c8d818614ad6e52d684b9954b0d769ac (diff)
downloadnextcloud-server-9508a58c79a175cabcf46b5014b34730707e4fc0.tar.gz
nextcloud-server-9508a58c79a175cabcf46b5014b34730707e4fc0.zip
Merge pull request #1944 from owncloud/query-caching-upgrade
Disable prepared query caching while doing an upgrade
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/db.php b/lib/db.php
index fb2c027cdb9..1fd852b370f 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -42,6 +42,7 @@ class OC_DB {
const BACKEND_MDB2=1;
static private $preparedQueries = array();
+ static private $cachingEnabled = true;
/**
* @var MDB2_Driver_Common
@@ -356,7 +357,7 @@ class OC_DB {
}
}
} else {
- if (isset(self::$preparedQueries[$query])) {
+ if (isset(self::$preparedQueries[$query]) and self::$cachingEnabled) {
return self::$preparedQueries[$query];
}
}
@@ -382,7 +383,7 @@ class OC_DB {
}
$result=new PDOStatementWrapper($result);
}
- if (is_null($limit) || $limit == -1) {
+ if ((is_null($limit) || $limit == -1) and self::$cachingEnabled ) {
self::$preparedQueries[$rawQuery] = $result;
}
return $result;
@@ -915,6 +916,16 @@ class OC_DB {
}
return $msg;
}
+
+ /**
+ * @param bool $enabled
+ */
+ static public function enableCaching($enabled) {
+ if (!$enabled) {
+ self::$preparedQueries = array();
+ }
+ self::$cachingEnabled = $enabled;
+ }
}
/**