diff options
-rw-r--r-- | apps/files_sharing/sharedstorage.php | 16 | ||||
-rw-r--r-- | apps/files_texteditor/ajax/savefile.php | 2 | ||||
-rw-r--r-- | files/ajax/upload.php | 2 | ||||
-rw-r--r-- | lib/filestorage.php | 1 | ||||
-rw-r--r-- | lib/filestorage/local.php | 11 | ||||
-rw-r--r-- | lib/filesystem.php | 28 |
6 files changed, 6 insertions, 54 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 431b6a1adb8..b37806c75d9 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -481,22 +481,6 @@ class OC_Filestorage_Shared extends OC_Filestorage { } } - public function fromUploadedFile($tmpFile, $path) { - if ($this->is_writeable($path)) { - $source = $this->getSource($path); - if ($source) { - $storage = OC_Filesystem::getStorage($source); - $result = $storage->fromUploadedFile($tmpFile, $this->getInternalPath($source)); - if ($result) { - $this->clearFolderSizeCache($path); - } - return $result; - } - } else { - return false; - } - } - public function getMimeType($path) { $source = $this->getSource($path); if ($source) { diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php index f1a2bafc12b..a9777eb4133 100644 --- a/apps/files_texteditor/ajax/savefile.php +++ b/apps/files_texteditor/ajax/savefile.php @@ -37,7 +37,7 @@ $sessionname = sha1('oc_file_hash_'.$path); function do_save($path,$filecontents){ $sessionname = md5('oc_file_hash_'.$path); - OC_Filesystem::update_session_file_hash($sessionname,sha1(htmlspecialchars($filecontents))); + $_SESSION[$sessionname] = sha1(htmlspecialchars($filecontents)); OC_Filesystem::file_put_contents($path, $filecontents); } diff --git a/files/ajax/upload.php b/files/ajax/upload.php index 041ec0c92e3..d9dafde7779 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -46,7 +46,7 @@ if(strpos($dir,'..') === false){ $fileCount=count($files['name']); for($i=0;$i<$fileCount;$i++){ $target=stripslashes($dir) . $files['name'][$i]; - if(OC_Filesystem::fromUploadedFile($files['tmp_name'][$i],$target)){ + if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){ $result[]=array( "status" => "success", 'mime'=>OC_Filesystem::getMimeType($target),'size'=>OC_Filesystem::filesize($target),'name'=>$files['name'][$i]); } } diff --git a/lib/filestorage.php b/lib/filestorage.php index 90071a86dbe..70aaf985b8b 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -47,7 +47,6 @@ class OC_Filestorage{ public function fopen($path,$mode){} public function toTmpFile($path){}//copy the file to a temporary file, used for cross-storage file actions public function fromTmpFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions - public function fromUploadedFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions public function getMimeType($path){} public function hash($type,$path,$raw){} public function free_space($path){} diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 7711116db35..b5d6023c494 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -189,17 +189,6 @@ class OC_Filestorage_Local extends OC_Filestorage{ } } - public function fromUploadedFile($tmpFile,$path){ - $fileStats = stat($tmpFile); - if(move_uploaded_file($tmpFile,$this->datadir.$path)){ - touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); - $this->clearFolderSizeCache($path); - return true; - }else{ - return false; - } - } - private function delTree($dir) { $dirRelative=$dir; $dir=$this->datadir.$dir; diff --git a/lib/filesystem.php b/lib/filesystem.php index a25e8697985..268f7ddbd28 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -200,6 +200,10 @@ class OC_Filesystem{ } } + /** + * following functions are equivilent to their php buildin equivilents for arguments/return values. + */ + static public function mkdir($path){ return self::basicOperation('mkdir',$path,array('create','write')); } @@ -362,26 +366,6 @@ class OC_Filesystem{ } } } - static public function fromUploadedFile($tmpFile,$path){ - if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){ - $run=true; - $exists=self::file_exists($path); - if(!$exists){ - OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run)); - } - if($run){ - OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); - } - if($run){ - $result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path)); - if(!$exists){ - OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); - } - OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); - return $result; - } - } - } static public function getMimeType($path){ return self::basicOperation('getMimeType',$path); } @@ -413,10 +397,6 @@ class OC_Filesystem{ } - static public function update_session_file_hash($sessionname,$sessionvalue){ - $_SESSION[$sessionname] = $sessionvalue; - } - /** * abstraction for running most basic operations * @param string $operation |