summaryrefslogtreecommitdiffstats
path: root/lib/files/view.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-03-08 15:28:45 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-03-08 15:28:45 -0500
commitd7beac6d6f3ad588cee6c5ba8a2145b42fa184a2 (patch)
tree613f576938ee8ef88a5a93304a824f60fbb85a7a /lib/files/view.php
parent2ed850e05b46d820528813c2f2415dad60c1c570 (diff)
parent546fb72b25fb8ebdc70aa75ccc7a095d7d83b174 (diff)
downloadnextcloud-server-d7beac6d6f3ad588cee6c5ba8a2145b42fa184a2.tar.gz
nextcloud-server-d7beac6d6f3ad588cee6c5ba8a2145b42fa184a2.zip
Merge branch 'master' into filecache_mtime
Conflicts: lib/files/view.php lib/util.php tests/lib/files/cache/cache.php
Diffstat (limited to 'lib/files/view.php')
-rw-r--r--lib/files/view.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/files/view.php b/lib/files/view.php
index 3348244715e..3cea8b082dc 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -199,7 +199,7 @@ class View {
@ob_end_clean();
$handle = $this->fopen($path, 'rb');
if ($handle) {
- $chunkSize = 8192; // 8 MB chunks
+ $chunkSize = 8192; // 8 kB chunks
while (!feof($handle)) {
echo fread($handle, $chunkSize);
flush();
@@ -245,7 +245,11 @@ class View {
if (!is_null($mtime) and !is_numeric($mtime)) {
$mtime = strtotime($mtime);
}
- $result = $this->basicOperation('touch', $path, array('write'), $mtime);
+ $hooks = array('touch');
+ if (!$this->file_exists($path)) {
+ $hooks[] = 'write';
+ }
+ $result = $this->basicOperation('touch', $path, $hooks, $mtime);
if (!$result) { //if native touch fails, we emulate it by changing the mtime in the cache
$this->putFileInfo($path, array('mtime' => $mtime));
}
@@ -289,7 +293,7 @@ class View {
}
$target = $this->fopen($path, 'w');
if ($target) {
- $count = \OC_Helper::streamCopy($data, $target);
+ list ($count, $result) = \OC_Helper::streamCopy($data, $target);
fclose($target);
fclose($data);
if ($this->fakeRoot == Filesystem::getRoot()) {
@@ -307,7 +311,7 @@ class View {
);
}
\OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
- return $count > 0;
+ return $result;
} else {
return false;
}
@@ -365,10 +369,9 @@ class View {
} else {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
- $count = \OC_Helper::streamCopy($source, $target);
+ list($count, $result) = \OC_Helper::streamCopy($source, $target);
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
$storage1->unlink($internalPath1);
- $result = $count > 0;
}
if ($this->fakeRoot == Filesystem::getRoot()) {
\OC_Hook::emit(
@@ -448,7 +451,7 @@ class View {
} else {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
- $result = \OC_Helper::streamCopy($source, $target);
+ list($count, $result) = \OC_Helper::streamCopy($source, $target);
}
if ($this->fakeRoot == Filesystem::getRoot()) {
\OC_Hook::emit(
@@ -601,6 +604,7 @@ class View {
if ($path == null) {
return false;
}
+
$run = $this->runHooks($hooks, $path);
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
if ($run and $storage) {
@@ -965,7 +969,7 @@ class View {
*/
public function getPath($id) {
list($storage, $internalPath) = Cache\Cache::getById($id);
- $mounts = Mount::findById($storage);
+ $mounts = Mount::findByStorageId($storage);
foreach ($mounts as $mount) {
/**
* @var \OC\Files\Mount $mount