diff options
Diffstat (limited to 'apps/files_external/lib/swift.php')
-rw-r--r-- | apps/files_external/lib/swift.php | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index 632c72c280f..2f0076706e4 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -39,8 +39,8 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @return string */ private function getContainerName($path) { - $path=trim(trim($this->root,'/')."/".$path,'/.'); - return str_replace('/','\\',$path); + $path=trim(trim($this->root, '/')."/".$path, '/.'); + return str_replace('/', '\\', $path); } /** @@ -189,7 +189,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string name * @return bool */ - private function addSubContainer($container,$name) { + private function addSubContainer($container, $name) { if(!$name) { return false; } @@ -201,16 +201,16 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ foreach($containers as &$sub) { $sub=trim($sub); } - if(array_search($name,$containers)!==false) { + if(array_search($name, $containers)!==false) { unlink($tmpFile); return false; }else{ - $fh=fopen($tmpFile,'a'); - fwrite($fh,$name."\n"); + $fh=fopen($tmpFile, 'a'); + fwrite($fh, $name."\n"); } }catch(Exception $e) { $containers=array(); - file_put_contents($tmpFile,$name."\n"); + file_put_contents($tmpFile, $name."\n"); } $obj->load_from_filename($tmpFile); @@ -224,7 +224,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @param string name * @return bool */ - private function removeSubContainer($container,$name) { + private function removeSubContainer($container, $name) { if(!$name) { return false; } @@ -239,13 +239,13 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ foreach($containers as &$sub) { $sub=trim($sub); } - $i=array_search($name,$containers); + $i=array_search($name, $containers); if($i===false) { unlink($tmpFile); return false; }else{ unset($containers[$i]); - file_put_contents($tmpFile, implode("\n",$containers)."\n"); + file_put_contents($tmpFile, implode("\n", $containers)."\n"); } $obj->load_from_filename($tmpFile); @@ -337,12 +337,12 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ public function opendir($path) { $container=$this->getContainer($path); $files=$this->getObjects($container); - $i=array_search(self::SUBCONTAINER_FILE,$files); + $i=array_search(self::SUBCONTAINER_FILE, $files); if($i!==false) { unset($files[$i]); } $subContainers=$this->getSubContainers($container); - $files=array_merge($files,$subContainers); + $files=array_merge($files, $subContainers); $id=$this->getContainerName($path); OC_FakeDirStream::$dirs[$id]=$files; return opendir('fakedir://'.$id); @@ -380,7 +380,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ return $obj->read(); } - public function file_put_contents($path,$content) { + public function file_put_contents($path, $content) { $obj=$this->getObject($path); if(is_null($obj)) { $container=$this->getContainer(dirname($path)); @@ -406,7 +406,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - public function fopen($path,$mode) { + public function fopen($path, $mode) { switch($mode) { case 'r': case 'rb': @@ -432,9 +432,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ case 'c': case 'c+': $tmpFile=$this->getTmpFile($path); - OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack'); + OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this, 'writeBack'); self::$tempFiles[$tmpFile]=$path; - return fopen('close://'.$tmpFile,$mode); + return fopen('close://'.$tmpFile, $mode); } } @@ -449,7 +449,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ return 1024*1024*1024*8; } - public function touch($path,$mtime=null) { + public function touch($path, $mtime=null) { $obj=$this->getObject($path); if(is_null($obj)) { return false; @@ -463,10 +463,10 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ $obj->sync_metadata(); } - public function rename($path1,$path2) { + public function rename($path1, $path2) { $sourceContainer=$this->getContainer(dirname($path1)); $targetContainer=$this->getContainer(dirname($path2)); - $result=$sourceContainer->move_object_to(basename($path1),$targetContainer, basename($path2)); + $result=$sourceContainer->move_object_to(basename($path1), $targetContainer, basename($path2)); unset($this->objects[$path1]); if($result) { $targetObj=$this->getObject($path2); @@ -475,10 +475,10 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ return $result; } - public function copy($path1,$path2) { + public function copy($path1, $path2) { $sourceContainer=$this->getContainer(dirname($path1)); $targetContainer=$this->getContainer(dirname($path2)); - $result=$sourceContainer->copy_object_to(basename($path1),$targetContainer, basename($path2)); + $result=$sourceContainer->copy_object_to(basename($path1), $targetContainer, basename($path2)); if($result) { $targetObj=$this->getObject($path2); $this->resetMTime($targetObj); @@ -525,7 +525,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } } - private function fromTmpFile($tmpFile,$path) { + private function fromTmpFile($tmpFile, $path) { $obj=$this->getObject($path); if(is_null($obj)) { $obj=$this->createObject($path); |