Only prepare an SQL statement once.

remotes/origin/stable6
Arthur Schiwon 13 years ago
parent 1d676fb0e6
commit 2a2d409733
  1. 5
      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'], '"');

Loading…
Cancel
Save