本文整理匯總了PHP中Git::exec方法的典型用法代碼示例。如果您正苦於以下問題:PHP Git::exec方法的具體用法?PHP Git::exec怎麽用?PHP Git::exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Git
的用法示例。
在下文中一共展示了Git::exec方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postDeploy
/**
* Execute post commands.
*
* @var array
*/
public function postDeploy(array $commands)
{
foreach ($commands as $command) {
$this->cli->out("Execute : <white>{$command}");
$output = $this->git->exec($command);
$output = implode(' ', $output);
$this->cli->out("Result : <white>{$output}");
}
}
示例2: apiDownload
/**
* Entry point for Problem Download API
*
* @param Request $r
* @throws InvalidFilesystemOperationException
* @throws InvalidDatabaseOperationException
*/
public static function apiDownload(Request $r)
{
self::authenticateRequest($r);
// Validate request
self::validateDownload($r);
// Get HEAD revision to avoid race conditions.
$gitDir = PROBLEMS_GIT_PATH . DIRECTORY_SEPARATOR . $r['problem']->alias;
$git = new Git($gitDir);
$head = trim($git->get(array('rev-parse', 'HEAD')));
// Set headers to auto-download file
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: application/zip');
header('Content-Disposition: attachment;filename=' . $r['problem']->alias . '_' . $head . '.zip');
header('Content-Transfer-Encoding: binary');
$git->exec(array('archive', '--format=zip', $head));
die;
}