From 2a2d409733dfb339dac49cfdddc2a627d4e5d581 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 25 Mar 2013 21:46:50 +0100 Subject: Only prepare an SQL statement once. --- lib/files/cache/legacy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/files/cache/legacy.php b/lib/files/cache/legacy.php index ddee75e972b..f114cf0c837 100644 --- a/lib/files/cache/legacy.php +++ b/lib/files/cache/legacy.php @@ -91,11 +91,14 @@ class Legacy { * @return string */ function getEtag($path) { + static $query = null; list(, $user, , $relativePath) = explode('/', $path, 4); if (is_null($relativePath)) { $relativePath = ''; } - $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND propertypath = ? AND propertyname = "{DAV:}getetag"'); + if(is_null($query)){ + $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND propertypath = ? AND propertyname = "{DAV:}getetag"'); + } $result = $query->execute(array($user, '/' . $relativePath)); if ($row = $result->fetchRow()) { return trim($row['propertyvalue'], '"'); -- cgit v1.2.3