diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 431b6a1adb8b20716c7f34fa3fccc42bb8825cbd..b37806c75d9835793cd278d15e63fd6c8e684a1b 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 f1a2bafc12b71fe2049b3b1d0798d60831656359..a9777eb4133be39e1650042ddcf64ac3695dde77 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 041ec0c92e354284fb12d55d123eb94225b81094..d9dafde7779f9d931ef2a9e289cc099224136eb0 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 90071a86dbe9559a5a432177e44046720ef37d77..70aaf985b8b6d6a791dec9b5123df2b5e5d61ea2 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 7711116db354b5c33b6b0cb054932a439d174bb2..b5d6023c49465f50bb9a584a1c3d0a2ca558c206 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 a25e8697985c20ca8484aba829ae40b24c5002ea..268f7ddbd28697ce16935517e0a7bcdfd7f7798b 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