diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-07-29 21:03:53 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-07-29 21:03:53 +0200 |
commit | 2ff8d7a8bc067901ecbc64599b86d1b325f5fe98 (patch) | |
tree | 7523d0e4bde9a9c691112a71e2b0fe4c6904c078 /lib/files.php | |
parent | 2bfad189e7e9c8ea78e4b5f78c9e779074dd991c (diff) | |
download | nextcloud-server-2ff8d7a8bc067901ecbc64599b86d1b325f5fe98.tar.gz nextcloud-server-2ff8d7a8bc067901ecbc64599b86d1b325f5fe98.zip |
One class per file!
Diffstat (limited to 'lib/files.php')
-rw-r--r-- | lib/files.php | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/lib/files.php b/lib/files.php index d24eb282c45..03e159f9bee 100644 --- a/lib/files.php +++ b/lib/files.php @@ -298,79 +298,3 @@ class OC_FILES { @file_put_contents($SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it } } - -function zipAddDir($dir,$zip,$internalDir=''){ - $dirname=basename($dir); - $zip->addEmptyDir($internalDir.$dirname); - $internalDir.=$dirname.='/'; - $files=OC_FILES::getdirectorycontent($dir); - foreach($files as $file){ - $filename=$file['name']; - $file=$dir.'/'.$filename; - if(OC_FILESYSTEM::is_file($file)){ - $tmpFile=OC_FILESYSTEM::toTmpFile($file); - OC_FILES::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,$internalDir.$filename); - }elseif(OC_FILESYSTEM::is_dir($file)){ - zipAddDir($file,$zip,$internalDir); - } - } -} - -if(!function_exists('sys_get_temp_dir')) { - function sys_get_temp_dir() { - if( $temp=getenv('TMP') ) return $temp; - if( $temp=getenv('TEMP') ) return $temp; - if( $temp=getenv('TMPDIR') ) return $temp; - $temp=tempnam(__FILE__,''); - if (file_exists($temp)) { - unlink($temp); - return dirname($temp); - } - return null; - } -} - -global $FAKEDIRS; -$FAKEDIRS=array(); - -class fakeDirStream{ - private $name; - private $data; - private $index; - - public function dir_opendir($path,$options){ - global $FAKEDIRS; - $url=parse_url($path); - $this->name=substr($path,strlen('fakedir://')); - $this->index=0; - if(isset($FAKEDIRS[$this->name])){ - $this->data=$FAKEDIRS[$this->name]; - }else{ - $this->data=array(); - } - return true; - } - - public function dir_readdir(){ - if($this->index>=count($this->data)){ - return false; - } - $filename=$this->data[$this->index]; - $this->index++; - return $filename; - } - - public function dir_closedir() { - $this->data=false; - $this->name=''; - return true; - } - - public function dir_rewinddir() { - $this->index=0; - return true; - } -} -stream_wrapper_register("fakedir", "fakeDirStream"); -?> |