summaryrefslogtreecommitdiffstats
path: root/lib/filesystemview.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-15 16:23:00 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-21 20:48:48 +0100
commitc121a1a1e7d9ae554005b8438d8ad999cdacc601 (patch)
treeba22ce84a3eff604e856d4b626a084b47363ba6e /lib/filesystemview.php
parent6a8364c3ffeb9d6227f141ae77ba317a1afbfdf6 (diff)
downloadnextcloud-server-c121a1a1e7d9ae554005b8438d8ad999cdacc601.tar.gz
nextcloud-server-c121a1a1e7d9ae554005b8438d8ad999cdacc601.zip
implement file_put_contents with stream data using fopen
Diffstat (limited to 'lib/filesystemview.php')
-rw-r--r--lib/filesystemview.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 592fd972a78..58d5b3af715 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -163,7 +163,21 @@ class OC_FilesystemView {
return $this->basicOperation('file_get_contents',$path,array('read'));
}
public function file_put_contents($path,$data){
- return $this->basicOperation('file_put_contents',$path,array('create','write'),$data);
+ 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));
+ }
+ fclose($target);
+ fclose($data);
+ return true;
+ }else{
+ return false;
+ }
+ }else{
+ return $this->basicOperation('file_put_contents',$path,array('create','write'),$data);
+ }
}
public function unlink($path){
return $this->basicOperation('unlink',$path,array('delete'));