summaryrefslogtreecommitdiffstats
path: root/lib/files/view.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-10-26 12:43:23 +0200
committerRobin Appelman <icewind@owncloud.com>2012-10-26 12:43:23 +0200
commit7ef0ffe8ad8f95b023f95f80e7b91c2a3ee50c67 (patch)
tree8779cb7a51afafd2e79208249f77e01d8494cea4 /lib/files/view.php
parente63e246c4894aa7f72feb550d98747890838af0b (diff)
downloadnextcloud-server-7ef0ffe8ad8f95b023f95f80e7b91c2a3ee50c67.tar.gz
nextcloud-server-7ef0ffe8ad8f95b023f95f80e7b91c2a3ee50c67.zip
add View->putFileInfo to the filecache api
Diffstat (limited to 'lib/files/view.php')
-rw-r--r--lib/files/view.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/files/view.php b/lib/files/view.php
index aaca1618acb..094a7d92a4d 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -663,7 +663,7 @@ class View {
$path = \OC\Files\Filesystem::normalizePath($this->fakeRoot . '/' . $path);
/**
* @var \OC\Files\Storage\Storage $storage
- * @var string $path
+ * @var string $internalPath
*/
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
$cache = $storage->getCache();
@@ -700,7 +700,7 @@ class View {
$path = \OC\Files\Filesystem::normalizePath($this->fakeRoot . '/' . $directory);
/**
* @var \OC\Files\Storage\Storage $storage
- * @var string $path
+ * @var string $internalPath
*/
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
$cache = $storage->getCache();
@@ -737,4 +737,30 @@ class View {
usort($files, "fileCmp"); //TODO: remove this once ajax is merged
return $files;
}
+
+ /**
+ * change file metadata
+ *
+ * @param string $path
+ * @param array $data
+ * @return int
+ *
+ * returns the fileid of the updated file
+ */
+ public function putFileInfo($path, $data) {
+ $path = \OC\Files\Filesystem::normalizePath($this->fakeRoot . '/' . $path);
+ /**
+ * @var \OC\Files\Storage\Storage $storage
+ * @var string $internalPath
+ */
+ list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
+ $cache = $storage->getCache();
+
+ if (!$cache->inCache($internalPath)) {
+ $scanner = $storage->getScanner();
+ $scanner->scan($internalPath, \OC\Files\Cache\Scanner::SCAN_SHALLOW);
+ }
+
+ return $cache->put($internalPath, $data);
+ }
}