summaryrefslogtreecommitdiffstats
path: root/lib/filesystemview.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-11 15:48:31 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-21 20:48:48 +0100
commit1cffeefa069075054f9c2f676b84ddc02b56232c (patch)
tree240462f92b81db768d9c227974020579666c4849 /lib/filesystemview.php
parent6658f510986aff0e41fee37319a1b0eefa98a4d0 (diff)
downloadnextcloud-server-1cffeefa069075054f9c2f676b84ddc02b56232c.tar.gz
nextcloud-server-1cffeefa069075054f9c2f676b84ddc02b56232c.zip
move implementation of from/toTmpFile from the file storage to the filesystem
Diffstat (limited to 'lib/filesystemview.php')
-rw-r--r--lib/filesystemview.php34
1 files changed, 15 insertions, 19 deletions
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 0ce803be2b1..592fd972a78 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -254,29 +254,25 @@ class OC_FilesystemView {
return $this->basicOperation('fopen',$path,$hooks,$mode);
}
public function toTmpFile($path){
- if(OC_FileProxy::runPreProxies('toTmpFile',$path) and OC_Filesystem::isValidPath($path) and $storage=$this->getStorage($path)){
- OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_read, array( OC_Filesystem::signal_param_path => $path));
- return $storage->toTmpFile($this->getInternalPath($path));
+ if(OC_Filesystem::isValidPath($path)){
+ $source=$this->fopen($path,'r');
+ $tmpFile=tempnam(get_temp_dir(),'OC_TMP_').substr($path,strrpos($path,'.'));
+ if($source){
+ return file_put_contents($tmpFile,$source);
+ }
}
}
public function fromTmpFile($tmpFile,$path){
- if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and OC_Filesystem::isValidPath($path) and $storage=$this->getStorage($path)){
- $run=true;
- $exists=$this->file_exists($path);
- if(!$exists){
- OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, array( OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
- }
- if($run){
- OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, array( OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
- }
- if($run){
- $result=$storage->fromTmpFile($tmpFile,$this->getInternalPath($path));
- if(!$exists){
- OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_create, array( OC_Filesystem::signal_param_path => $path));
- }
- OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array( OC_Filesystem::signal_param_path => $path));
- return $result;
+ if(OC_Filesystem::isValidPath($path)){
+ $source=fopen($tmpFile,'r');
+ if($source){
+ $this->file_put_contents($path,$source);
+ unlink($tmpFile);
+ return true;
+ }else{
}
+ }else{
+ error_log('invalid path');
}
}