代码拉取完成,页面将自动刷新
同步操作将从 李小凯/Snipe-IT 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
#!/usr/bin/php -q
/* PHP requires defined timezone; GitHub uses UTC */
ini_set( 'date.timezone', 'UTC' );
/*
* YOU MUST CHANGE THESE VARIABLES
*/
$gh_user = 'snipe';
$gh_repo = 'snipe-it';
$file = 'CHANGELOG.md';
$string = 'fix|resolve|close|#changelog';
$omit = 'fuck';
/*
* No need to change anything below here
*/
// Clear old changelog info
file_put_contents($file,'');
$url = 'https://api.github.com/repos/'.$gh_user.'/'.$gh_repo.'/releases';
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_USERAGENT,$gh_user);
$data = curl_exec($ch);
curl_close($ch);
$releases = json_decode($data, TRUE);
while( $obj = array_shift( $releases ) )
{
/* Define the beginning of each release block in the changelog */
$changelog = "\n\n### ".$obj['name']." - Released ".date("M d, Y h:i:s",strtotime($obj['created_at']))."\n";
$changelog .= $obj['prerelease'] == 'true' ? '#### This is a pre-release '."\n": '';
file_put_contents($file,$changelog,FILE_APPEND);
/* Retrieve and format each commit entry */
$gitlog = 'git log '.escapeshellarg($obj['tag_name']);
/* Set commit limit based on next tag name */
if ( $next = current($releases) )
{
$gitlog .= '...'.escapeshellarg($next['tag_name']).' ';
}
else $gitlog .= ' ';
$gitlog .= '--pretty=format:\'* <a href="http://github.com/'.$gh_user.'/'.$gh_repo.'/commit/%H">view</a> •';
$gitlog .= ' %s \' --reverse | grep -i -E '.escapeshellarg($string).' ';
if ($omit!=''){
$gitlog .= ' | grep -i -E -v '.escapeshellarg($omit).'';
}
$gitlog .= '>> '.escapeshellarg($file);
exec($gitlog);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。