Store etags in the file cache
This commit is contained in:
parent
d275725e23
commit
2c23e143d3
|
@ -189,6 +189,14 @@
|
||||||
<length>4</length>
|
<length>4</length>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
|
<field>
|
||||||
|
<name>etag</name>
|
||||||
|
<type>text</type>
|
||||||
|
<default></default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>250</length>
|
||||||
|
</field>
|
||||||
|
|
||||||
<index>
|
<index>
|
||||||
<name>storage_path_hash</name>
|
<name>storage_path_hash</name>
|
||||||
<unique>true</unique>
|
<unique>true</unique>
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Cache {
|
||||||
$params = array($file);
|
$params = array($file);
|
||||||
}
|
}
|
||||||
$query = \OC_DB::prepare(
|
$query = \OC_DB::prepare(
|
||||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
|
||||||
FROM `*PREFIX*filecache` ' . $where);
|
FROM `*PREFIX*filecache` ' . $where);
|
||||||
$result = $query->execute($params);
|
$result = $query->execute($params);
|
||||||
$data = $result->fetchRow();
|
$data = $result->fetchRow();
|
||||||
|
@ -107,7 +107,7 @@ class Cache {
|
||||||
$fileId = $this->getId($folder);
|
$fileId = $this->getId($folder);
|
||||||
if ($fileId > -1) {
|
if ($fileId > -1) {
|
||||||
$query = \OC_DB::prepare(
|
$query = \OC_DB::prepare(
|
||||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
|
||||||
FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
|
FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
|
||||||
$result = $query->execute(array($fileId));
|
$result = $query->execute(array($fileId));
|
||||||
return $result->fetchAll();
|
return $result->fetchAll();
|
||||||
|
@ -180,7 +180,7 @@ class Cache {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static function buildParts(array $data) {
|
static function buildParts(array $data) {
|
||||||
$fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'encrypted');
|
$fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'encrypted', 'etag');
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
$queryParts = array();
|
$queryParts = array();
|
||||||
|
@ -333,7 +333,7 @@ class Cache {
|
||||||
*/
|
*/
|
||||||
public function search($pattern) {
|
public function search($pattern) {
|
||||||
$query = \OC_DB::prepare('
|
$query = \OC_DB::prepare('
|
||||||
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
|
||||||
FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `storage` = ?'
|
FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `storage` = ?'
|
||||||
);
|
);
|
||||||
$result = $query->execute(array($pattern, $this->numericId));
|
$result = $query->execute(array($pattern, $this->numericId));
|
||||||
|
@ -357,7 +357,7 @@ class Cache {
|
||||||
$where = '`mimepart` = ?';
|
$where = '`mimepart` = ?';
|
||||||
}
|
}
|
||||||
$query = \OC_DB::prepare('
|
$query = \OC_DB::prepare('
|
||||||
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
|
SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
|
||||||
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'
|
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'
|
||||||
);
|
);
|
||||||
$result = $query->execute(array($mimetype, $this->numericId));
|
$result = $query->execute(array($mimetype, $this->numericId));
|
||||||
|
|
|
@ -58,6 +58,7 @@ class Scanner {
|
||||||
$data['size'] = $this->storage->filesize($path);
|
$data['size'] = $this->storage->filesize($path);
|
||||||
$data['permissions'] = $this->storage->getPermissions($path);
|
$data['permissions'] = $this->storage->getPermissions($path);
|
||||||
}
|
}
|
||||||
|
$data['etag'] = $this->storage->getETag($path);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class OC_Util {
|
||||||
*/
|
*/
|
||||||
public static function getVersion() {
|
public static function getVersion() {
|
||||||
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
|
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
|
||||||
return array(4,91,04);
|
return array(4,91,05);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue