summaryrefslogtreecommitdiffstats
path: root/lib/files/cache
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-03-24 16:20:59 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-03-27 19:17:49 +0100
commit19c7d9c3dcbce1c6b2d38f82d61a8d95a800a65a (patch)
tree1f061c5f69e02ced4ae88f0acf24f29b20a33a8c /lib/files/cache
parent588e1547cff50de4a2b03d2540b7ad93c2093f8e (diff)
downloadnextcloud-server-19c7d9c3dcbce1c6b2d38f82d61a8d95a800a65a.tar.gz
nextcloud-server-19c7d9c3dcbce1c6b2d38f82d61a8d95a800a65a.zip
Port Icewind's fix I
Diffstat (limited to 'lib/files/cache')
-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 eac2795d6df..55e40e1af72 100644
--- a/lib/files/cache/legacy.php
+++ b/lib/files/cache/legacy.php
@@ -79,7 +79,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 '';
+ }
}
/**
@@ -91,6 +107,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 ab64a65a285..4d60199b154 100644
--- a/lib/files/cache/upgrade.php
+++ b/lib/files/cache/upgrade.php
@@ -134,6 +134,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);