代码拉取完成,页面将自动刷新
同步操作将从 oldhuhu/DiscuzXPack 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
function download_branch_zip($branch, $target)
{
$url = 'https://gitee.com/ComsenzDiscuz/DiscuzX/repository/archive/' . $branch . '.zip';
logging\info('start downloading %s', $url);
$newf = fopen($target, 'wb');
if (!$newf) {
logging\error("cannot create file %s", $target);
exit(1);
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $newf);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'curl/7.64.1');
// curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress');
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$proxy = getenv("http_proxy");
if ($proxy) {
logging\info("setting proxy as %s", $proxy);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
}
logging\log(LOG_LEVEL_INFO, ' downloaded: 0 KB');
curl_exec($ch);
curl_close($ch);
echo "\n";
fclose($newf);
}
function progress($resource, $download_size, $downloaded, $upload_size, $uploaded)
{
echo "\r";
logging\log(LOG_LEVEL_INFO, ' downloaded: %d KB', $downloaded / 1000);
}
function get_last_commit_id($branch) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, "https://gitee.com/ComsenzDiscuz/DiscuzX/tree/" . $branch . "/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$contents = curl_exec($ch);
curl_close($ch);
if (preg_match('/class="repo-index-commit-msg" href="\/ComsenzDiscuz\/DiscuzX\/commit\/(.*)"/m', $contents, $m)) {
return substr($m[1], 0, 8);
}
if (preg_match('/href="\/ComsenzDiscuz\/DiscuzX\/commit\/(.*)" class="repo-index-commit-msg"/m', $contents, $m)) {
return substr($m[1], 0, 8);
}
return FALSE;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。