本文整理汇总了PHP中Git::get_bin方法的典型用法代码示例。如果您正苦于以下问题:PHP Git::get_bin方法的具体用法?PHP Git::get_bin怎么用?PHP Git::get_bin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Git
的用法示例。
在下文中一共展示了Git::get_bin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initRepo
private function initRepo()
{
//get path to the repo root (by default DokuWiki's savedir)
if (defined('DOKU_FARM')) {
$repoPath = $this->getConf('repoPath');
} else {
$repoPath = DOKU_INC . $this->getConf('repoPath');
}
//set the path to the git binary
$gitPath = trim($this->getConf('gitPath'));
if ($gitPath !== '') {
Git::set_bin($gitPath);
}
//init the repo and create a new one if it is not present
io_mkdir_p($repoPath);
$repo = new GitRepo($repoPath, true, true);
//set git working directory (by default DokuWiki's savedir)
$repoWorkDir = DOKU_INC . $this->getConf('repoWorkDir');
Git::set_bin(Git::get_bin() . ' --work-tree ' . escapeshellarg($repoWorkDir));
$params = str_replace(array('%mail%', '%user%'), array($this->getAuthorMail(), $this->getAuthor()), $this->getConf('addParams'));
if ($params) {
Git::set_bin(Git::get_bin() . ' ' . $params);
}
return $repo;
}
示例2: 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());
}
}
示例3: run
/**
* Run a git command in the git repository
*
* Accepts a git command to run
*
* @access public
* @param string command to run
* @return string
*/
public function run($command)
{
return $this->run_command(Git::get_bin() . ' ' . $command);
}
示例4: test
/**
* Tests if git is installed
*
* @access public
* @return bool
*/
public function test()
{
$descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$pipes = array();
$resource = proc_open(Git::get_bin(), $descriptorspec, $pipes);
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
foreach ($pipes as $pipe) {
fclose($pipe);
}
$status = trim(proc_close($resource));
return $status != 127;
}