当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_PackageFile_v1::setPackage方法代码示例

本文整理汇总了PHP中PEAR_PackageFile_v1::setPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v1::setPackage方法的具体用法?PHP PEAR_PackageFile_v1::setPackage怎么用?PHP PEAR_PackageFile_v1::setPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_PackageFile_v1的用法示例。


在下文中一共展示了PEAR_PackageFile_v1::setPackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

 function _convertPackage($packagexml)
 {
     $pkg =& $this->getPackageFile($this->config);
     $pf2 =& $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
     if (!is_a($pf2, 'PEAR_PackageFile_v2')) {
         return $this->raiseError('Cannot process "' . $packagexml . '", is not a package.xml 2.0');
     }
     require_once 'PEAR/PackageFile/v1.php';
     $pf = new PEAR_PackageFile_v1();
     $pf->setConfig($this->config);
     if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", is not an extension source package.  Using a PEAR_PackageFileManager-based ' . 'script is an option');
     }
     if (is_array($pf2->getUsesRole())) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains custom roles.  Using a PEAR_PackageFileManager-based script or ' . 'the convert command is an option');
     }
     if (is_array($pf2->getUsesTask())) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains custom tasks.  Using a PEAR_PackageFileManager-based script or ' . 'the convert command is an option');
     }
     $deps = $pf2->getDependencies();
     if (isset($deps['group'])) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains dependency groups.  Using a PEAR_PackageFileManager-based script ' . 'or the convert command is an option');
     }
     if (isset($deps['required']['subpackage']) || isset($deps['optional']['subpackage'])) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains subpackage dependencies.  Using a PEAR_PackageFileManager-based  ' . 'script is an option');
     }
     if (isset($deps['required']['os'])) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains os dependencies.  Using a PEAR_PackageFileManager-based  ' . 'script is an option');
     }
     if (isset($deps['required']['arch'])) {
         return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains arch dependencies.  Using a PEAR_PackageFileManager-based  ' . 'script is an option');
     }
     $pf->setPackage($pf2->getPackage());
     $pf->setSummary($pf2->getSummary());
     $pf->setDescription($pf2->getDescription());
     foreach ($pf2->getMaintainers() as $maintainer) {
         $pf->addMaintainer($maintainer['role'], $maintainer['handle'], $maintainer['name'], $maintainer['email']);
     }
     $pf->setVersion($pf2->getVersion());
     $pf->setDate($pf2->getDate());
     $pf->setLicense($pf2->getLicense());
     $pf->setState($pf2->getState());
     $pf->setNotes($pf2->getNotes());
     $pf->addPhpDep($deps['required']['php']['min'], 'ge');
     if (isset($deps['required']['php']['max'])) {
         $pf->addPhpDep($deps['required']['php']['max'], 'le');
     }
     if (isset($deps['required']['package'])) {
         if (!isset($deps['required']['package'][0])) {
             $deps['required']['package'] = array($deps['required']['package']);
         }
         foreach ($deps['required']['package'] as $dep) {
             if (!isset($dep['channel'])) {
                 return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains uri-based dependency on a package.  Using a ' . 'PEAR_PackageFileManager-based script is an option');
             }
             if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net') {
                 return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains dependency on a non-standard channel package.  Using a ' . 'PEAR_PackageFileManager-based script is an option');
             }
             if (isset($dep['conflicts'])) {
                 return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains conflicts dependency.  Using a ' . 'PEAR_PackageFileManager-based script is an option');
             }
             if (isset($dep['exclude'])) {
                 $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
             }
             if (isset($dep['min'])) {
                 $pf->addPackageDep($dep['name'], $dep['min'], 'ge');
             }
             if (isset($dep['max'])) {
                 $pf->addPackageDep($dep['name'], $dep['max'], 'le');
             }
         }
     }
     if (isset($deps['required']['extension'])) {
         if (!isset($deps['required']['extension'][0])) {
             $deps['required']['extension'] = array($deps['required']['extension']);
         }
         foreach ($deps['required']['extension'] as $dep) {
             if (isset($dep['conflicts'])) {
                 return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains conflicts dependency.  Using a ' . 'PEAR_PackageFileManager-based script is an option');
             }
             if (isset($dep['exclude'])) {
                 $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
             }
             if (isset($dep['min'])) {
                 $pf->addExtensionDep($dep['name'], $dep['min'], 'ge');
             }
             if (isset($dep['max'])) {
                 $pf->addExtensionDep($dep['name'], $dep['max'], 'le');
             }
         }
     }
     if (isset($deps['optional']['package'])) {
         if (!isset($deps['optional']['package'][0])) {
             $deps['optional']['package'] = array($deps['optional']['package']);
         }
         foreach ($deps['optional']['package'] as $dep) {
             if (!isset($dep['channel'])) {
                 return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains uri-based dependency on a package.  Using a ' . 'PEAR_PackageFileManager-based script is an option');
             }
             if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net') {
//.........这里部分代码省略.........
开发者ID:villos,项目名称:tree_admin,代码行数:101,代码来源:Pickle.php

示例2: array

 function _detect1($deps, $pname, $options, $params)
 {
     $this->_downloadDeps = array();
     $skipnames = array();
     foreach ($deps as $dep) {
         $nodownload = false;
         if ($dep['type'] == 'pkg') {
             $dep['channel'] = 'pear.php.net';
             $dep['package'] = $dep['name'];
             switch ($dep['rel']) {
                 case 'not':
                     continue 2;
                 case 'ge':
                 case 'eq':
                 case 'gt':
                 case 'has':
                     $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                     if (PEAR_Downloader_Package::willDownload($dep, $params)) {
                         $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed');
                         continue 2;
                     }
                     $fakedp = new PEAR_PackageFile_v1();
                     $fakedp->setPackage($dep['name']);
                     // skip internet check if we are not upgrading (bug #5810)
                     if (!isset($options['upgrade']) && $this->isInstalled($fakedp, $dep['rel'])) {
                         $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", is already installed');
                         continue 2;
                     }
             }
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             if ($this->_explicitState) {
                 $pname['state'] = $this->_explicitState;
             }
             $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
             $chan = 'pear.php.net';
             if (PEAR::isError($url)) {
                 // check to see if this is a pecl package that has jumped
                 // from pear.php.net to pecl.php.net channel
                 if (!class_exists('PEAR_Dependency2')) {
                     require_once 'PEAR/Dependency2.php';
                 }
                 $newdep = PEAR_Dependency2::normalizeDep($dep);
                 $newdep = $newdep[0];
                 $newdep['channel'] = 'pecl.php.net';
                 $chan = 'pecl.php.net';
                 $url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname);
                 $obj =& $this->_registry->getPackage($dep['name']);
                 if (PEAR::isError($url)) {
                     PEAR::popErrorHandling();
                     if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) {
                         $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                         $dep['package'] = $dep['name'];
                         if (!isset($options['soft'])) {
                             $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $obj->getVersion());
                         }
                         if (@$skipnames[count($skipnames) - 1] == $this->_registry->parsedPackageNameToString($dep, true)) {
                             array_pop($skipnames);
                         }
                         continue;
                     } else {
                         if (isset($dep['optional']) && $dep['optional'] == 'yes') {
                             $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", no releases exist');
                             continue;
                         } else {
                             return $url;
                         }
                     }
                 }
             }
             PEAR::popErrorHandling();
             if (!isset($options['alldeps'])) {
                 if (isset($dep['optional']) && $dep['optional'] == 'yes') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
                 if (!isset($dep['optional']) || $dep['optional'] == 'no') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             // check to see if a dep is already installed
             // do not try to move this before getDepPackageDownloadURL
             // we can't determine whether upgrade is necessary until we know what
             // version would be downloaded
             if (!isset($options['force']) && $this->isInstalled($url, $dep['rel'])) {
                 $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                 $dep['package'] = $dep['name'];
                 if (isset($newdep)) {
                     $version = $this->_registry->packageInfo($newdep['name'], 'version', $newdep['channel']);
                 } else {
                     $version = $this->_registry->packageInfo($dep['name'], 'version');
                 }
//.........这里部分代码省略.........
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:Package.php


注:本文中的PEAR_PackageFile_v1::setPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。