diff options
Diffstat (limited to 'lib/filestorage')
-rw-r--r-- | lib/filestorage/common.php | 20 | ||||
-rw-r--r-- | lib/filestorage/local.php | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php index c77df38e6b1..4f506a31495 100644 --- a/lib/filestorage/common.php +++ b/lib/filestorage/common.php @@ -223,6 +223,26 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { OC_Helper::streamCopy($source,$target); return $tmpFile; } + public function getLocalFolder($path){ + $baseDir=OC_Helper::tmpFolder(); + $this->addLocalFolder($path,$baseDir); + return $baseDir; + } + private function addLocalFolder($path,$target){ + if($dh=$this->opendir($path)){ + while($file=readdir($dh)){ + if($file!=='.' and $file!=='..'){ + if($this->is_dir($path.'/'.$file)){ + mkdir($target.'/'.$file); + $this->addLocalFolder($path.'/'.$file,$target.'/'.$file); + }else{ + $tmp=$this->toTmpFile($path.'/'.$file); + rename($tmp,$target.'/'.$file); + } + } + } + } + } // abstract public function touch($path, $mtime=null); protected function searchInDir($query,$dir=''){ diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index d60f32b15be..2087663809f 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -168,7 +168,10 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{ return $this->searchInDir($query); } public function getLocalFile($path){ - return $this->datadir.$path; + return $this->datadir.$path; + } + public function getLocalFolder($path){ + return $this->datadir.$path; } protected function searchInDir($query,$dir=''){ |