Exemplo n.º 1
0
 /**
  * @param string channel name
  * @param bool whether to strictly retrieve channel names
  * @return PEAR_ChannelFile|PEAR_Error
  * @access private
  */
 function &_getChannel($channel, $noaliases = false)
 {
     $ch = false;
     if ($this->_channelExists($channel, $noaliases)) {
         $chinfo = $this->_channelInfo($channel, $noaliases);
         if ($chinfo) {
             if (!class_exists('PEAR_ChannelFile')) {
                 require_once 'PEAR/ChannelFile.php';
             }
             $ch =& PEAR_ChannelFile::fromArrayWithErrors($chinfo);
         }
     }
     if ($ch) {
         if ($ch->validate()) {
             return $ch;
         }
         foreach ($ch->getErrors(true) as $err) {
             $message = $err['message'] . "\n";
         }
         $ch = PEAR::raiseError($message);
         return $ch;
     }
     if ($this->_getChannelFromAlias($channel) == 'pear.php.net') {
         // the registry is not properly set up, so use defaults
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $pear_channel = new PEAR_ChannelFile();
         $pear_channel->setServer('pear.php.net');
         $pear_channel->setAlias('pear');
         $pear_channel->setSummary('PHP Extension and Application Repository');
         $pear_channel->setDefaultPEARProtocols();
         $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
         $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
         $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/');
         return $pear_channel;
     }
     if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') {
         // the registry is not properly set up, so use defaults
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $pear_channel = new PEAR_ChannelFile();
         $pear_channel->setServer('pecl.php.net');
         $pear_channel->setAlias('pecl');
         $pear_channel->setSummary('PHP Extension Community Library');
         $pear_channel->setDefaultPEARProtocols();
         $pear_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
         $pear_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
         $pear_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
         return $pear_channel;
     }
     if ($this->_getChannelFromAlias($channel) == 'doc.php.net') {
         // the registry is not properly set up, so use defaults
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $doc_channel = new PEAR_ChannelFile();
         $doc_channel->setServer('doc.php.net');
         $doc_channel->setAlias('phpdocs');
         $doc_channel->setSummary('PHP Documentation Team');
         $doc_channel->setDefaultPEARProtocols();
         $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/');
         $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/');
         $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/');
         return $doc_channel;
     }
     if ($this->_getChannelFromAlias($channel) == '__uri') {
         // the registry is not properly set up, so use defaults
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $private = new PEAR_ChannelFile();
         $private->setName('__uri');
         $private->setDefaultPEARProtocols();
         $private->setBaseURL('REST1.0', '****');
         $private->setSummary('Pseudo-channel for static packages');
         return $private;
     }
     return $ch;
 }
Exemplo n.º 2
0
 function _initializeChannelDirs()
 {
     static $running = false;
     if (!$running) {
         $running = true;
         $ds = DIRECTORY_SEPARATOR;
         if (!is_dir($this->channelsdir) || !file_exists($this->channelsdir . $ds . 'pear.php.net.reg') || !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') || !file_exists($this->channelsdir . $ds . '__uri.reg')) {
             if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
                 $pear_channel = $this->_pearChannel;
                 if (!is_a($pear_channel, 'PEAR_ChannelFile') || !$pear_channel->validate()) {
                     if (!class_exists('PEAR_ChannelFile')) {
                         require_once 'PEAR/ChannelFile.php';
                     }
                     $pear_channel = new PEAR_ChannelFile();
                     $pear_channel->setName('pear.php.net');
                     $pear_channel->setAlias('pear');
                     $pear_channel->setServer('pear.php.net');
                     $pear_channel->setSummary('PHP Extension and Application Repository');
                     $pear_channel->setDefaultPEARProtocols();
                     $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
                     $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
                 } else {
                     $pear_channel->setName('pear.php.net');
                     $pear_channel->setAlias('pear');
                 }
                 $pear_channel->validate();
                 $this->_addChannel($pear_channel);
             }
             if (!file_exists($this->channelsdir . $ds . 'pecl.php.net.reg')) {
                 $pecl_channel = $this->_peclChannel;
                 if (!is_a($pecl_channel, 'PEAR_ChannelFile') || !$pecl_channel->validate()) {
                     if (!class_exists('PEAR_ChannelFile')) {
                         require_once 'PEAR/ChannelFile.php';
                     }
                     $pecl_channel = new PEAR_ChannelFile();
                     $pecl_channel->setName('pecl.php.net');
                     $pecl_channel->setAlias('pecl');
                     $pecl_channel->setServer('pecl.php.net');
                     $pecl_channel->setSummary('PHP Extension Community Library');
                     $pecl_channel->setDefaultPEARProtocols();
                     $pecl_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
                     $pecl_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
                     $pecl_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
                 } else {
                     $pecl_channel->setName('pecl.php.net');
                     $pecl_channel->setAlias('pecl');
                 }
                 $pecl_channel->validate();
                 $this->_addChannel($pecl_channel);
             }
             if (!file_exists($this->channelsdir . $ds . '__uri.reg')) {
                 if (!class_exists('PEAR_ChannelFile')) {
                     require_once 'PEAR/ChannelFile.php';
                 }
                 $private = new PEAR_ChannelFile();
                 $private->setName('__uri');
                 $private->addFunction('xmlrpc', '1.0', '****');
                 $private->setSummary('Pseudo-channel for static packages');
                 $this->_addChannel($private);
             }
             $this->_rebuildFileMap();
         }
         $running = false;
     }
 }