mirror of
https://github.com/nextcloud/server.git
synced 2026-02-11 14:54:02 -05:00
Only prepare an SQL statement once.
This commit is contained in:
parent
1d676fb0e6
commit
2a2d409733
1 changed files with 4 additions and 1 deletions
5
lib/files/cache/legacy.php
vendored
5
lib/files/cache/legacy.php
vendored
|
|
@ -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…
Reference in a new issue