aboutsummaryrefslogtreecommitdiffstats
path: root/lib/filesystemview.php
diff options
context:
space:
mode:
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');
}
}