本文整理汇总了PHP中PEAR_PackageFile_v2::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v2::getChannel方法的具体用法?PHP PEAR_PackageFile_v2::getChannel怎么用?PHP PEAR_PackageFile_v2::getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFile_v2
的用法示例。
在下文中一共展示了PEAR_PackageFile_v2::getChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
//.........这里部分代码省略.........
$fail = false;
if (array_key_exists('usesrole', $this->_packageInfo)) {
$roles = $this->_packageInfo['usesrole'];
if (!is_array($roles) || !isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if (!isset($role['role'])) {
$this->_usesroletaskMustHaveRoleTask('usesrole', 'role');
$fail = true;
} else {
if (!isset($role['channel'])) {
if (!isset($role['uri'])) {
$this->_usesroletaskMustHaveChannelOrUri($role['role'], 'usesrole');
$fail = true;
}
} elseif (!isset($role['package'])) {
$this->_usesroletaskMustHavePackage($role['role'], 'usesrole');
$fail = true;
}
}
}
}
if (array_key_exists('usestask', $this->_packageInfo)) {
$roles = $this->_packageInfo['usestask'];
if (!is_array($roles) || !isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if (!isset($role['task'])) {
$this->_usesroletaskMustHaveRoleTask('usestask', 'task');
$fail = true;
} else {
if (!isset($role['channel'])) {
if (!isset($role['uri'])) {
$this->_usesroletaskMustHaveChannelOrUri($role['task'], 'usestask');
$fail = true;
}
} elseif (!isset($role['package'])) {
$this->_usesroletaskMustHavePackage($role['task'], 'usestask');
$fail = true;
}
}
}
}
if ($fail) {
return false;
}
$list = $this->_packageInfo['contents'];
if (isset($list['dir']) && is_array($list['dir']) && isset($list['dir'][0])) {
$this->_multipleToplevelDirNotAllowed();
return $this->_isValid = 0;
}
$this->_validateFilelist();
$this->_validateRelease();
if (!$this->_stack->hasErrors()) {
$chan = $this->_pf->_registry->getChannel($this->_pf->getChannel(), true);
if (PEAR::isError($chan)) {
$this->_unknownChannel($this->_pf->getChannel());
} else {
$valpack = $chan->getValidationPackage();
// for channel validator packages, always use the default PEAR validator.
// otherwise, they can't be installed or packaged
$validator = $chan->getValidationObject($this->_pf->getPackage());
if (!$validator) {
$this->_stack->push(__FUNCTION__, 'error', array_merge(array('channel' => $chan->getName(), 'package' => $this->_pf->getPackage()), $valpack), 'package "%channel%/%package%" cannot be properly validated without ' . 'validation package "%channel%/%name%-%version%"');
return $this->_isValid = 0;
}
$validator->setPackageFile($this->_pf);
$validator->validate($state);
$failures = $validator->getFailures();
foreach ($failures['errors'] as $error) {
$this->_stack->push(__FUNCTION__, 'error', $error, 'Channel validator error: field "%field%" - %reason%');
}
foreach ($failures['warnings'] as $warning) {
$this->_stack->push(__FUNCTION__, 'warning', $warning, 'Channel validator warning: field "%field%" - %reason%');
}
}
}
$this->_pf->_isValid = $this->_isValid = !$this->_stack->hasErrors('error');
if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$this->_filesValid) {
if ($this->_pf->getPackageType() == 'bundle') {
if ($this->_analyzeBundledPackages()) {
$this->_filesValid = $this->_pf->_filesValid = true;
} else {
$this->_pf->_isValid = $this->_isValid = 0;
}
} else {
if (!$this->_analyzePhpFiles()) {
$this->_pf->_isValid = $this->_isValid = 0;
} else {
$this->_filesValid = $this->_pf->_filesValid = true;
}
}
}
if ($this->_isValid) {
return $this->_pf->_isValid = $this->_isValid = $state;
}
return $this->_pf->_isValid = $this->_isValid = 0;
}
示例2: Array
//.........这里部分代码省略.........
if (!is_array($xml) || !isset($xml['paramgroup'])) {
$script->run(array(), '_default');
} else {
if (!isset($xml['paramgroup'][0])) {
$xml['paramgroup'] = array($xml['paramgroup']);
}
foreach ($xml['paramgroup'] as $i => $group) {
if (isset($_SESSION['_PEAR_Frontend_Web_ScriptSkipSections'][$group['id']])) {
continue;
}
if (isset($_SESSION['_PEAR_Frontend_Web_ScriptSection'])) {
if ($i < $_SESSION['_PEAR_Frontend_Web_ScriptSection']) {
$lastgroup = $group;
continue;
}
}
if (isset($_SESSION['_PEAR_Frontend_Web_answers'])) {
$answers = $_SESSION['_PEAR_Frontend_Web_answers'];
}
if (isset($group['name'])) {
if (isset($answers)) {
if (isset($answers[$group['name']])) {
switch ($group['conditiontype']) {
case '=':
if ($answers[$group['name']] != $group['value']) {
continue 2;
}
break;
case '!=':
if ($answers[$group['name']] == $group['value']) {
continue 2;
}
break;
case 'preg_match':
if (!@preg_match('/' . $group['value'] . '/', $answers[$group['name']])) {
continue 2;
}
break;
default:
$this->_clearScriptSession();
return;
}
}
} else {
$this->_clearScriptSession();
return;
}
}
if (!isset($group['param'][0])) {
$group['param'] = array($group['param']);
}
$_SESSION['_PEAR_Frontend_Web_ScriptSection'] = $i;
if (!isset($answers)) {
$answers = array();
}
if (isset($group['param'])) {
if (method_exists($script, 'postProcessPrompts')) {
$prompts = $script->postProcessPrompts($group['param'], $group['name']);
if (!is_array($prompts) || count($prompts) != count($group['param'])) {
$this->outputData('postinstall', 'Error: post-install script did not ' . 'return proper post-processed prompts');
$prompts = $group['param'];
} else {
foreach ($prompts as $i => $var) {
if (!is_array($var) || !isset($var['prompt']) || !isset($var['name']) || $var['name'] != $group['param'][$i]['name'] || $var['type'] != $group['param'][$i]['type']) {
$this->outputData('postinstall', 'Error: post-install script ' . 'modified the variables or prompts, severe security risk. ' . 'Will instead use the defaults from the package.xml');
$prompts = $group['param'];
}
}
}
$answers = array_merge($answers, $this->confirmDialog($prompts, $pkg->getChannel() . '/' . $pkg->getPackage()));
} else {
$answers = array_merge($answers, $this->confirmDialog($group['param'], $pkg->getChannel() . '/' . $pkg->getPackage()));
}
}
if ($answers) {
array_unshift($_SESSION['_PEAR_Frontend_Web_ScriptCompletedPhases'], $group['id']);
if (!$script->run($answers, $group['id'])) {
$script->run($_SESSION['_PEAR_Frontend_Web_ScriptCompletedPhases'], '_undoOnError');
$this->_clearScriptSession();
return;
}
} else {
$script->run(array(), '_undoOnError');
$this->_clearScriptSession();
return;
}
$lastgroup = $group;
foreach ($group['param'] as $param) {
// rename the current params to save for future tests
$answers[$group['id'] . '::' . $param['name']] = $answers[$param['name']];
unset($answers[$param['name']]);
}
// save the script's variables and user answers for the next round
$_SESSION['_PEAR_Frontend_Web_ScriptObj'] = (array) $script;
$_SESSION['_PEAR_Frontend_Web_answers'] = $answers;
$_SERVER['REQUEST_METHOD'] = '';
}
}
$this->_clearScriptSession();
}