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


PHP PEAR_ChannelFile::fromXmlFile方法代码示例

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


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

示例1: discover

 /**
  * Attempt to discover a channel's remote capabilities from
  * its server name
  * @param string
  * @return boolean
  */
 function discover($channel)
 {
     $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
     $a = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, System::mktemp(array('-d')), $callback, false);
     PEAR::popErrorHandling();
     if (PEAR::isError($a)) {
         return false;
     }
     list($a, $lastmodified) = $a;
     $b = new PEAR_ChannelFile();
     if ($b->fromXmlFile($a)) {
         unlink($a);
         if ($this->config->get('auto_discover')) {
             $this->_registry->addChannel($b, $lastmodified);
             $alias = $b->getName();
             if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
                 $alias = $b->getAlias();
             }
             $this->log(1, 'Auto-discovered channel "' . $channel . '", alias "' . $alias . '", adding to registry');
         }
         return true;
     }
     unlink($a);
     return false;
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:33,代码来源:Downloader.php

示例2: discover

 /**
  * Attempt to discover a channel's remote capabilities from
  * its server name
  * @param string
  * @return boolean
  */
 function discover($channel)
 {
     $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
     if (!class_exists('System')) {
         require_once 'System.php';
     }
     $tmpdir = $this->config->get('temp_dir');
     $tmp = System::mktemp('-d -t "' . $tmpdir . '"');
     $a = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
     PEAR::popErrorHandling();
     if (PEAR::isError($a)) {
         // Attempt to fallback to https automatically.
         PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
         $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
         $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
         PEAR::popErrorHandling();
         if (PEAR::isError($a)) {
             return false;
         }
     }
     list($a, $lastmodified) = $a;
     if (!class_exists('PEAR_ChannelFile')) {
         require_once 'PEAR/ChannelFile.php';
     }
     $b = new PEAR_ChannelFile();
     if ($b->fromXmlFile($a)) {
         unlink($a);
         if ($this->config->get('auto_discover')) {
             $this->_registry->addChannel($b, $lastmodified);
             $alias = $b->getName();
             if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
                 $alias = $b->getAlias();
             }
             $this->log(1, 'Auto-discovered channel "' . $channel . '", alias "' . $alias . '", adding to registry');
         }
         return true;
     }
     unlink($a);
     return false;
 }
开发者ID:shen0834,项目名称:util,代码行数:48,代码来源:Downloader.php

示例3:

 /**
  * Set the output macros based on a channel source
  */
 function _doMakeRPMFromChannel($source_file, $options, $params)
 {
     // Set the name of the template spec file to use by default
     $this->_template_spec_name = 'template-channel.spec';
     // Create a PEAR_ChannelFile object
     if (!class_exists('PEAR_ChannelFile')) {
         require_once 'PEAR/ChannelFile.php';
     }
     $cf = new PEAR_ChannelFile();
     // Load in the channel.xml file from the source XML
     $cf->fromXmlFile($source_file);
     // Set the output macros
     $this->_output['channel_alias'] = $cf->getAlias();
     $this->_output['master_server'] = $cf->getName();
     $this->_output['possible_channel'] = $cf->getName();
     $this->_output['rpm_package'] = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chan');
     $rpmdep = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chandep');
     if (!empty($rpmdep) && $rpmdep != $this->_output['rpm_package']) {
         $this->_output['extra_headers'] = $this->_formatRpmHeader('Provides', "{$rpmdep}") . "\n";
     }
     // Channels don't really have version numbers; this will need to be
     // hand-maintained in the spec
     $this->_output['version'] = '1.0';
 }
开发者ID:cmooony,项目名称:d4d-studio,代码行数:27,代码来源:Packaging.php


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