umzug auf gitea

This commit is contained in:
hwd
2018-04-11 22:17:21 +02:00
parent 4c8459ac31
commit afadb05774
1755 changed files with 534624 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
# http://stackoverflow.com/a/4914807/5690568
// Get real path for our folder
$rootPath = realpath('xlsx_tmp');
// Initialize archive object
$zip = new ZipArchive();
$zip->open('resulting_excel/test.xlsx', ZipArchive::CREATE | ZipArchive::OVERWRITE);
// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
// Skip directories (they would be added automatically)
if (!$file->isDir())
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
}
}
// Zip archive will be created only after closing object
$zip->close();
exec('rm -R xlsx_tmp/*');
?>