summaryrefslogtreecommitdiffstats
path: root/lib/filesystemview.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-27 12:20:37 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-27 12:20:37 +0100
commitd8d4420f227588acedb50918a1b794a2c68a7ade (patch)
tree6ea8ee6c75353b2308c229530749cc2641925462 /lib/filesystemview.php
parentcef230c141897f587dd732860cca6568fd6edc2c (diff)
downloadnextcloud-server-d8d4420f227588acedb50918a1b794a2c68a7ade.tar.gz
nextcloud-server-d8d4420f227588acedb50918a1b794a2c68a7ade.zip
some cleanup in filestorage
Diffstat (limited to 'lib/filesystemview.php')
-rw-r--r--lib/filesystemview.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 9f0a88f8ab0..b014c3272f7 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -173,13 +173,11 @@ class OC_FilesystemView {
if(is_resource($data)){//not having to deal with streams in file_put_contents makes life easier
$target=$this->fopen($path,'w');
if($target){
- while(!feof($data)){
- fwrite($target,fread($data,8192));
- }
+ $count=OC_Helper::streamCopy($data,$target);
fclose($target);
fclose($data);
OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array( OC_Filesystem::signal_param_path => $path));
- return true;
+ return $count>0;
}else{
return false;
}
@@ -204,9 +202,7 @@ class OC_FilesystemView {
}else{
$source=$this->fopen($path1,'r');
$target=$this->fopen($path2,'w');
- while (!feof($source)){
- fwrite($target,fread($source,8192));
- }
+ $count=OC_Helper::streamCopy($data,$target);
$storage1=$this->getStorage($path1);
$storage1->unlink($this->getInternalPath($path1));
}
@@ -236,11 +232,7 @@ class OC_FilesystemView {
}else{
$source=$this->fopen($path1,'r');
$target=$this->fopen($path2,'w');
- if($target and $source){
- while (!feof($source)){
- fwrite($target,fread($source,8192));
- }
- }
+ $count=OC_Helper::streamCopy($data,$target);
}
OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_copy, array( OC_Filesystem::signal_param_oldpath => $path1 , OC_Filesystem::signal_param_newpath=>$path2));
if(!$exists){