summaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorBart Visscher <bart@thisnet.nl>2011-09-18 20:57:05 +0200
committerBart Visscher <bart@thisnet.nl>2011-09-18 20:57:05 +0200
commit8966ed5a004a9b830f093355170d381566d58554 (patch)
treec114ef6ceb1e385b10bf015ce3ad00bae5ed89bd /lib/files.php
parent82c7598861db175617694891bb9f21b426426225 (diff)
downloadnextcloud-server-8966ed5a004a9b830f093355170d381566d58554.tar.gz
nextcloud-server-8966ed5a004a9b830f093355170d381566d58554.zip
Cleanup lib/base.php
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/files.php b/lib/files.php
index 84dc9fd1c53..631726bf9b5 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -102,7 +102,7 @@ class OC_Files {
self::$tmpFiles[]=$tmpFile;
$zip->addFile($tmpFile,basename($file));
}elseif(OC_Filesystem::is_dir($file)){
- zipAddDir($file,$zip);
+ self::zipAddDir($file,$zip);
}
}
$zip->close();
@@ -113,7 +113,7 @@ class OC_Files {
exit("cannot open <$filename>\n");
}
$file=$dir.'/'.$files;
- zipAddDir($file,$zip);
+ self::zipAddDir($file,$zip);
$zip->close();
}else{
$zip=false;
@@ -156,6 +156,23 @@ class OC_Files {
}
}
+ public static 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)){
+ self::zipAddDir($file,$zip,$internalDir);
+ }
+ }
+ }
/**
* move a file or folder
*