代码拉取完成,页面将自动刷新
同步操作将从 头上有灰机/DiscuzXPack 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
function extract_zip($zipfile, $targetfolder)
{
logging\info("extracting zip from %s to %s", $zipfile, $targetfolder);
global $G_HAS_ZIP_COMMAND;
if ($G_HAS_ZIP_COMMAND) {
exec('unzip -o ' . $zipfile . ' -d ' . $targetfolder, $output, $res);
if ($res != 0) {
logging\error("cannot extract zip file %s", $zipfile);
exit(1);
}
return;
}
$zip = new ZipArchive;
$res = $zip->open($zipfile);
if ($res === true) {
$zip->extractTo($targetfolder);
$zip->close();
} else {
logging\error("cannot extract zip file %s", $zipfile);
exit(1);
}
}
function add_files_in_folder($zip, $folder, $base_folder)
{
$dir = @opendir(join_paths($base_folder, $folder));
while ($entry = readdir($dir)) {
if ($entry == '.' || $entry == '..') continue;
$relative_path = join_paths($folder, $entry);
$absolute_path = join_paths($base_folder, $relative_path);
if (is_dir($absolute_path)) {
add_files_in_folder($zip, $relative_path, $base_folder);
} else {
$zip->addFile($absolute_path, $relative_path);
}
}
closedir($dir);
}
function make_zip($zipfile, $folder)
{
logging\info("compressing %s to %s", $folder, $zipfile);
global $G_HAS_ZIP_COMMAND;
if ($G_HAS_ZIP_COMMAND) {
exec('cd "' . $folder . '" && zip -r ' . $zipfile . ' .', $output, $res);
if ($res != 0) {
logging\error("cannot create zip file %s", $zipfile);
exit(1);
}
return;
}
$zip = new ZipArchive;
if ($zip->open($zipfile, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
add_files_in_folder($zip, '', $folder);
$zip->close();
} else {
logging\error("cannot create zip file %s", $zipfile);
exit(1);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。