本文整理汇总了PHP中PEAR_PackageFile_v2::getTask方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v2::getTask方法的具体用法?PHP PEAR_PackageFile_v2::getTask怎么用?PHP PEAR_PackageFile_v2::getTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFile_v2
的用法示例。
在下文中一共展示了PEAR_PackageFile_v2::getTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//.........这里部分代码省略.........
if (isset($file['attribs']) && isset($file['attribs']['role'])) {
if (!$this->_validateRole($file['attribs']['role'])) {
if (isset($this->_packageInfo['usesrole'])) {
$roles = $this->_packageInfo['usesrole'];
if (!isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if ($role['role'] = $file['attribs']['role']) {
$msg = 'This package contains role "%role%" and requires ' . 'package "%package%" to be used';
if (isset($role['uri'])) {
$params = array('role' => $role['role'], 'package' => $role['uri']);
} else {
$params = array('role' => $role['role'], 'package' => $this->_pf->_registry->parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true));
}
$this->_stack->push('_mustInstallRole', 'error', $params, $msg);
}
}
}
$this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']);
}
}
if (!isset($file['attribs'])) {
continue;
}
$save = $file['attribs'];
if ($dirs) {
$save['name'] = $dirs . '/' . $save['name'];
}
unset($file['attribs']);
if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) {
// has tasks
foreach ($file as $task => $value) {
if ($tagClass = $this->_pf->getTask($task)) {
if (!is_array($value) || !isset($value[0])) {
$value = array($value);
}
foreach ($value as $v) {
$ret = call_user_func(array($tagClass, 'validateXml'), $this->_pf, $v, $this->_pf->_config, $save);
if (is_array($ret)) {
$this->_invalidTask($task, $ret, @$save['name']);
}
}
} else {
if (isset($this->_packageInfo['usestask'])) {
$roles = $this->_packageInfo['usestask'];
if (!isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if ($role['task'] = $task) {
$msg = 'This package contains task "%task%" and requires ' . 'package "%package%" to be used';
if (isset($role['uri'])) {
$params = array('task' => $role['task'], 'package' => $role['uri']);
} else {
$params = array('task' => $role['task'], 'package' => $this->_pf->_registry->parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true));
}
$this->_stack->push('_mustInstallTask', 'error', $params, $msg);
}
}
}
$this->_unknownTask($task, $save['name']);
}
}
}
}
示例2: array
//.........这里部分代码省略.........
if (isset($file['attribs']) && isset($file['attribs']['role'])) {
if (!$this->_validateRole($file['attribs']['role'])) {
if (isset($this->_packageInfo['usesrole'])) {
$roles = $this->_packageInfo['usesrole'];
if (!isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if ($role['role'] = $file['attribs']['role']) {
$msg = 'This package contains role "%role%" and requires ' . 'package "%package%" to be used';
if (isset($role['uri'])) {
$params = array('role' => $role['role'], 'package' => $role['uri']);
} else {
$params = array('role' => $role['role'], 'package' => $this->_pf->_registry->parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true));
}
$this->_stack->push('_mustInstallRole', 'error', $params, $msg);
}
}
}
$this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']);
}
}
if (!isset($file['attribs'])) {
continue;
}
$save = $file['attribs'];
if ($dirs) {
$save['name'] = $dirs . '/' . $save['name'];
}
unset($file['attribs']);
if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) {
// has tasks
foreach ($file as $task => $value) {
if ($tagClass = $this->_pf->getTask($task)) {
if (!is_array($value) || !isset($value[0])) {
$value = array($value);
}
foreach ($value as $v) {
$ret = call_user_func(array($tagClass, 'validateXml'), $this->_pf, $v, $this->_pf->_config, $save);
if (is_array($ret)) {
$this->_invalidTask($task, $ret, isset($save['name']) ? $save['name'] : '');
}
}
} else {
if (isset($this->_packageInfo['usestask'])) {
$roles = $this->_packageInfo['usestask'];
if (!isset($roles[0])) {
$roles = array($roles);
}
foreach ($roles as $role) {
if ($role['task'] = $task) {
$msg = 'This package contains task "%task%" and requires ' . 'package "%package%" to be used';
if (isset($role['uri'])) {
$params = array('task' => $role['task'], 'package' => $role['uri']);
} else {
$params = array('task' => $role['task'], 'package' => $this->_pf->_registry->parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true));
}
$this->_stack->push('_mustInstallTask', 'error', $params, $msg);
}
}
}
$this->_unknownTask($task, $save['name']);
}
}
}
}
示例3: array
function _validateFilelist($list = false, $allowignore = false, $dirs = '')
{
$iscontents = false;
if (!$list) {
$iscontents = true;
$list = $this->_packageInfo['contents'];
if (isset($this->_packageInfo['bundle'])) {
return $this->_validateBundle($list);
}
}
if ($allowignore) {
$struc = array('*install->name->as', '*ignore->name');
} else {
$struc = array('*dir->name->?baseinstalldir', '*file->name->role->?baseinstalldir->?md5sum');
}
if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
$unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
$dirname = $iscontents ? '<contents>' : $unknown;
} else {
$dirname = '<dir name="' . $list['attribs']['name'] . '">';
}
$res = $this->_stupidSchemaValidate($struc, $list, $dirname);
if ($allowignore && $res) {
$this->_pf->getFilelist();
$fcontents = $this->_pf->getContents();
$filelist = array();
if (!isset($fcontents['dir']['file'][0])) {
$fcontents['dir']['file'] = array($fcontents['dir']['file']);
}
foreach ($fcontents['dir']['file'] as $file) {
$filelist[$file['attribs']['name']] = true;
}
if (isset($list['install'])) {
if (!isset($list['install'][0])) {
$list['install'] = array($list['install']);
}
foreach ($list['install'] as $file) {
if (!isset($filelist[$file['attribs']['name']])) {
$this->_notInContents($file['attribs']['name'], 'install');
}
}
}
if (isset($list['ignore'])) {
if (!isset($list['ignore'][0])) {
$list['ignore'] = array($list['ignore']);
}
foreach ($list['ignore'] as $file) {
if (!isset($filelist[$file['attribs']['name']])) {
$this->_notInContents($file['attribs']['name'], 'ignore');
}
}
}
}
if (!$allowignore && isset($list['file'])) {
if (!isset($list['file'][0])) {
// single file
$list['file'] = array($list['file']);
}
foreach ($list['file'] as $i => $file) {
if (isset($file['attribs']) && isset($file['attribs']['role'])) {
if (!$this->_validateRole($file['attribs']['role'])) {
$this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']);
}
}
if (!isset($file['attribs'])) {
continue;
}
$save = $file['attribs'];
if ($dirs) {
$save['name'] = $dirs . '/' . $save['name'];
}
unset($file['attribs']);
if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) {
// has tasks
foreach ($file as $task => $value) {
if ($tagClass = $this->_pf->getTask($task)) {
if (!is_array($value) || !isset($value[0])) {
$value = array($value);
}
foreach ($value as $v) {
$ret = call_user_func(array($tagClass, 'validateXml'), $this->_pf, $v, $this->_pf->_config, $save);
if (is_array($ret)) {
$this->_invalidTask($task, $ret, @$save['name']);
}
}
} else {
$this->_unknownTask($task, $save['name']);
}
}
}
}
}
if (isset($list['ignore'])) {
if (!$allowignore) {
$this->_ignoreNotAllowed('ignore');
}
}
if (isset($list['install'])) {
if (!$allowignore) {
$this->_ignoreNotAllowed('install');
//.........这里部分代码省略.........