Exemplo n.º 1
0
 /**
  * Compare Stability
  *
  * @param string $s1
  * @param string $s2
  * @return int
  */
 public function compareStabilities($s1, $s2)
 {
     if (!$this->_validator) {
         $this->_validator = new Mage_Connect_Validator();
     }
     return $this->_validator->compareStabilities($s1, $s2);
 }
Exemplo n.º 2
0
 /**
  * Check channel, add if valid name and not exist
  * @param string $chanName
  * @param Mage_Connect_Config $config
  * @param Mage_Connect_Rest $rest
  * @return boolean
  */
 public function checkChannel($chanName, $config, $rest = null)
 {
     if ($this->isChannel($chanName)) {
         return true;
     }
     $uri = '';
     $_validator = new Mage_Connect_Validator();
     if ($this->isChannelName($chanName)) {
         $uri = $this->chanUrl($chanName);
     } elseif ($_validator->validateUrl($chanName)) {
         $uri = $chanName;
     } elseif ($chanName) {
         $uri = $config->protocol . '://' . $chanName;
     } else {
         throw new Exception("'{$channel}' is not existant channel name / valid uri");
     }
     if ($uri && !$this->isChannel($uri)) {
         if (!isset($rest)) {
             $rest = new Mage_Connect_Rest($config->protocol);
         }
         $rest->setChannel($uri);
         $data = $rest->getChannelInfo();
         $data->uri = $uri;
         $this->addChannel($data->name, $uri);
     }
     return $this->isChannel($uri);
 }