本文整理汇总了PHP中Git::windows_mode方法的典型用法代码示例。如果您正苦于以下问题:PHP Git::windows_mode方法的具体用法?PHP Git::windows_mode怎么用?PHP Git::windows_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Git
的用法示例。
在下文中一共展示了Git::windows_mode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initRepo
private function initRepo()
{
if (!class_exists("Git")) {
require 'Git.php/Git.php';
}
$this->pullOnChange = c::get('gcapc-pull', false);
$this->pushOnChange = c::get('gcapc-push', false);
$this->commitOnChange = c::get('gcapc-commit', false);
$this->gitBin = c::get('gcapc-gitBin', '');
$this->windowsMode = c::get('gcapc-windowsMode', false);
if ($this->windowsMode) {
Git::windows_mode();
}
if ($this->gitBin) {
Git::set_bin($this->gitBin);
}
$this->repo = Git::open($this->repoPath);
if (!$this->repo->test_git()) {
trigger_error('git could not be found or is not working properly. ' . Git::get_bin());
}
}
示例2: gitpush
function gitpush($strRepo)
{
global $repo_dir, $eqdkp_dir, $git_path, $isWindows;
try {
if ($isWindows) {
Git::windows_mode();
}
Git::set_bin($git_path);
$repoPath = $strRepo == 'local_core' ? $eqdkp_dir : $repo_dir . $strRepo;
$repo = Git::open($repoPath);
notify($repo->status(true), 'Git Status before push');
$repo->push('origin', 'master');
notify($repo->status(true), 'Git Status after push');
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例3: substr
echo "<div id=\"checkwithfailed\">\r\n <span id=\"titleresult\">评估结果:</span>\r\n <span id=\"resultsentence\">没有通过评估</span>\r\n </div>\r\n <div id=\"declare\">\r\n <p>原因: 您的许可证文件已经被检测到, 但是内容并没有完全匹配到由OSI批准的";
echo substr($keyFiles[$minKey], 0, strrpos($keyFiles[$minKey], "."));
echo "许可证文件内容, 详细文本之间的差别请看下面:</p>\r\n <p><span style=\"background-color:#005500\"> </span>代表比标准文本增加的部分</p><p><span style=\"background-color:#990000\"> </span>代表比标准文本减少的部分</span></p>\r\n </div>\r\n <div id=\"originaldiv\">\r\n <div>您的许可证比较结果</div>\r\n <div id=\"originalcontent\"><pre>";
echo $comparedStandardLicenseFileContent;
echo "</pre></div>\r\n </div>\r\n <div id=\"standarddiv\">\r\n <div>";
echo substr($keyFiles[$minKey], 0, strrpos($keyFiles[$minKey], "."));
echo "</div>\r\n <div id=\"standardcontent\"><pre>";
echo htmlspecialchars($licensecollection[$keyFiles[$minKey]]);
echo "</pre></div>\r\n <div class=\"contact-us\">如果对检测结果有任何意见和反馈, 您可以<a href=\"http://www.kaiyuanshe.cn/feedback.php\">联系我们</a></div>\r\n <div class=\"page-jump\">\r\n <input type=\"button\" value=\"完成\" class=\"resolver-next\" data-redirect=\"/index.php\">\r\n </div>\r\n </div>\r\n </div>";
RemoveStatusRecords($sessionId, $conn, $logger, $loghelperArr);
}
} else {
$logger->log('debug', 'License file not found', $loghelperArr);
InsertStatusRecords($sessionId, "快速检测未找到许可文件,正在克隆代码仓库副本以便进一步检测", $conn, $logger, $loghelperArr);
// Git clone the repository based on git URL
Git::windows_mode();
$repo = new GitRepo();
// Get git client folder name
$comresult = stripos($urlText, '.git');
if ($comresult !== FALSE) {
$indexOfLastSplash = strrpos($urlText, "/");
$indexOfLastDot = strrpos($urlText, '.');
$GitName = substr($urlText, $indexOfLastSplash + 1, $indexOfLastDot - $indexOfLastSplash - 1);
} else {
$indexOfLastSplash = strrpos($urlText, '/');
$GitName = substr($urlText, $indexOfLastSplash + 1);
}
$logger->log('debug', 'GitName: ' . $GitName, $loghelperArr);
$ran = rand();
$timeparts = explode(' ', microtime());
$etime = $timeparts[1] . substr($timeparts[0], 1);
示例4: get_update
function get_update($sname, $file_lock, $base_url, $path, $mail_lock, $remote_git = '', $remote_branch = '')
{
session_name($sname);
session_start();
set_time_limit(300);
ignore_user_abort(true);
$stime = time();
$work = false;
//检测、设置工作标志,存在session里(同一个session_name在一个页面未结束前会保持读写锁状态)
if (empty($_SESSION['working'])) {
$work = true;
}
if (file_exists($file_lock)) {
$last_work_time = filemtime($file_lock);
if ($last_work_time > 0 && time() - $last_work_time < 120) {
//上次更新至今有120秒
echo "检测到正在进行工作中,本页面停止载入,请稍后再次访问。";
return false;
//exit;
}
$work = true;
unlink($file_lock);
} elseif (empty($_SESSION['work_time']) || $stime - $_SESSION['work_time'] > LOCK_TIME) {
//保证 LOCK_TIME 秒内只访问一次
$work = true;
}
if ($work && !file_exists($file_lock)) {
$_SESSION['working'] = true;
$_SESSION['work_time'] = $stime;
file_put_contents($file_lock, $stime);
} else {
echo "距离上次获取请求时间间隔多短,请稍后再次访问。";
return false;
//exit;
}
echo date("Y-m-d H:i:s") . " 读取列表中...<br>";
$list = get_list($base_url);
//获取列表
if (count($list) < 2) {
echo "读取Wiki列表失败,等待下次检测。<br>";
$_SESSION['work_time'] = $stime - LOCK_TIME;
//取消检查时间,让检测可在稍后再次发起
unlink($file_lock);
return false;
}
session_write_close();
//解除session,防止使其他访问页面一直等待session
mk_dir($path);
if (IS_WIN) {
Git::windows_mode();
}
if (!file_exists($path . '.git')) {
echo date("Y-m-d H:i:s") . " 没有git库,尝试创建...<br>";
if ($remote_git) {
//是否设置了远程仓库
echo "尝试从远程仓库克隆数据...<br>";
$ret = Git::clone_remote($path, $remote_git, $remote_branch);
//从远程仓库clone(可指定分支)
if (!Git::is_repo($ret) || !file_exists($path . '.git') || !$ret) {
echo "从远程仓库克隆失败,本地创建...<br>";
$ret = Git::create($path);
//如果clone失败,则本地创建
}
} else {
$ret = Git::create($path);
}
//直接本地创建
echo date("Y-m-d H:i:s") . " 创建结果:" . (Git::is_repo($ret) ? '成功' : '失败') . "<br>";
}
$files = ls_file($path);
foreach ($files as $file) {
if (!is_dir($path . $file)) {
unlink($path . $file);
}
}
$tmp_arr = parse_url($base_url);
$url_base = $tmp_arr['scheme'] . '://' . $tmp_arr['host'];
write($path . 'list.txt', json($list));
//写出列表
echo date("Y-m-d H:i:s") . " 读取wiki列表完毕,开始读取内容页...<br>";
$count = 0;
$content = get_content($base_url);
write($path . 'index.html', $content);
$count++;
foreach ($list as $arr) {
if (isset($arr['ul'])) {
foreach ($arr['ul'] as $a) {
if (substr($a['url'], 0, 1) == '.' || substr($a['url'], 0, 1) == '/') {
//地址以.或/开头,则为wiki文档
$content = get_content((substr($a['url'], 0, 1) == '/' ? $url_base : (substr($a['url'], 0, 1) == '.' ? $url_base . $tmp_arr['path'] : '')) . $a['url']);
if ($content) {
write($path . $a['title'] . '.html', $content);
$count++;
}
}
}
}
}
echo date("Y-m-d H:i:s") . " 获取操作完成,读取页面数量:" . $count . "<br>";
$repo = Git::open($path);
//.........这里部分代码省略.........