本文整理汇总了PHP中Source::validateSCM方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::validateSCM方法的具体用法?PHP Source::validateSCM怎么用?PHP Source::validateSCM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source::validateSCM方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see Action::execute()
*/
public function execute()
{
// call execute event
parent::execute();
if ($this->source->enableCheckout && $this->checkoutRepository) {
// load scm driver
$className = ucfirst(Source::validateSCM($this->source->scm));
// check out repository
require_once WCF_DIR . 'lib/system/scm/' . $className . '.class.php';
call_user_func(array($className, 'checkout'), $this->source->url, $this->source->sourceDirectory, array('username' => $this->source->username, 'password' => $this->source->password));
// set revision
$revision = $this->source->getHeadRevision();
$this->source->update(null, null, null, null, null, null, null, $revision);
}
// rebuild package data if requested
if ($this->rebuildPackageData) {
require_once PB_DIR . 'lib/system/package/PackageHelper.class.php';
PackageHelper::readPackages($this->source);
}
// call executed event
$this->executed();
// forward
HeaderUtil::redirect('index.php?page=SourceView&sourceID=' . $this->source->sourceID . SID_ARG_2ND_NOT_ENCODED);
exit;
}
示例2: update
/**
* Updates the data of a source.
*
* @param string $name The name of the source
* @param string $sourceDirectory Source directory used for files
* @param string $buildDirectory Build directory contains all archives
* @param string $scm Defines used SCM, may be 'git', 'none' and 'subversion'
* @param string $url URL for accessing subversion
* @param string $username Username neccessary if subversion repository is protected
* @param string $password Password neccessary if subversion repository is protected
* @param string $revision Currently used revision
* @param boolean $trustServerCert Automaticly trust server certificate
* @param boolean $enableCheckout Enables checkout ability
* @param integer $position Position used to order sources
*/
public function update($name = null, $sourceDirectory = null, $buildDirectory = null, $scm = null, $url = null, $username = null, $password = null, $revision = null, $trustServerCert = null, $enableCheckout = null, $position = null)
{
$fields = array();
if ($name !== null) {
$fields['name'] = $name;
}
if ($sourceDirectory !== null) {
$fields['sourceDirectory'] = $sourceDirectory;
}
if ($buildDirectory !== null) {
$fields['buildDirectory'] = $buildDirectory;
}
if ($scm !== null) {
$fields['scm'] = Source::validateSCM($scm);
}
if ($url !== null) {
$fields['url'] = $url;
}
if ($username !== null) {
$fields['username'] = $username;
}
if ($password !== null) {
$fields['password'] = $password;
}
if ($revision !== null) {
$fields['revision'] = $revision;
}
if ($trustServerCert !== null) {
$fields['trustServerCert'] = intval($trustServerCert);
}
if ($enableCheckout !== null) {
$fields['enableCheckout'] = intval($enableCheckout);
}
if ($position !== null) {
$fields['position'] = intval($position);
}
$this->updateData($fields);
}
示例3: validateSCM
/**
* Validates SCM and resets input fields if unused
*/
protected function validateSCM()
{
$this->scm = Source::validateSCM($this->scm);
switch ($this->scm) {
case 'none':
// reset input if no SCM is active
$this->username = $this->password = '';
$this->trustServerCert = $this->enableCheckout = 0;
break;
default:
if (empty($this->url)) {
throw new UserInputException('url', 'empty');
}
break;
}
}