您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
Mods-for-HESK-Netsyms/ci/deploy_release_to_github.php

49 行
1.4 KiB
PHP

<?php
$zip_name = "release.zip";
if (!extension_loaded("zip")) {
die("Cannot zip file contents!");
}
$zip = new ZipArchive();
$res = $zip->open($zip_name, ZipArchive::CREATE);
if ($res !== true) {
die("Failed to create zip!\n");
}
// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator("../"),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
echo "\nWorking with file " . $file->getFilename() . "\n";
continue;
if (substr($file->getFilename(), 0, strlen($file->getFilename())) === "." ||
strtolower($file->getFilename()) === 'attachments' ||
strtolower($file->getFilename()) === "contributing.md" ||
strtolower($file->getFilename() === "ci") ||
strtolower($file->getFilename() === "apidoc.json")) {
//-- Don"t compress . files
echo "Skipped file.\n";
continue;
}
// 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("../") + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
} else {
echo "Skipped directory " . $file->getFilename() . "\n";
}
}