Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-03-24 19:20:59 +0400
committerArthur Schiwon <blizzz@owncloud.com>2013-03-26 00:43:49 +0400
commit56302ff9cfc66c202cb8b81f69f97f88c9e95c0d (patch)
tree07e750f38dcca523cb2203842585eaf4975743a2
parent707de3e644c6e9119135c4784b11ec29d2edbced (diff)
Port Icewind's fix I
-rw-r--r--lib/files/cache/legacy.php24
-rw-r--r--lib/files/cache/upgrade.php1
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/files/cache/legacy.php b/lib/files/cache/legacy.php
index 2b8689fcbda..90f1803ebe3 100644
--- a/lib/files/cache/legacy.php
+++ b/lib/files/cache/legacy.php
@@ -72,7 +72,23 @@ class Legacy {
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` WHERE `path` = ?');
}
$result = $query->execute(array($path));
- return $result->fetchRow();
+ $data = $result->fetchRow();
+ $data['etag'] = $this->getEtag($data['path']);
+ return $data;
+ }
+
+ function getEtag($path) {
+ 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"');
+ $result = $query->execute(array($user, $relativePath));
+ if ($row = $result->fetchRow()) {
+ return trim($row['propertyvalue'], '"');
+ } else {
+ return '';
+ }
}
/**
@@ -82,6 +98,10 @@ class Legacy {
function getChildren($id) {
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` WHERE `parent` = ?');
$result = $query->execute(array($id));
- return $result->fetchAll();
+ $data = $result->fetchAll();
+ foreach ($data as $i => $item) {
+ $data[$i]['etag'] = $this->getEtag($item['path']);
+ }
+ return $data;
}
}
diff --git a/lib/files/cache/upgrade.php b/lib/files/cache/upgrade.php
index 07ae3ab8d84..5e7b29322df 100644
--- a/lib/files/cache/upgrade.php
+++ b/lib/files/cache/upgrade.php
@@ -127,6 +127,7 @@ class Upgrade {
*/
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($data['path']);
if ($storage) {
+ $newData['etag'] = $data['etag'];
$newData['path_hash'] = md5($internalPath);
$newData['path'] = $internalPath;
$newData['storage'] = $this->getNumericId($storage);