Пример #1
0
 public function runCommand($cmd, $options, $params)
 {
     $c = Mage_Connect_Command::getInstance($cmd);
     $c->run($cmd, $options, $params);
 }
Пример #2
0
 /**
  * Run commands from Mage_Connect_Command
  *
  * @param string $command
  * @param array $options
  * @param array $params
  * @return
  */
 public function run($command, $options = array(), $params = array())
 {
     @set_time_limit(0);
     @ini_set('memory_limit', '256M');
     if (empty($this->_cmdCache[$command])) {
         Mage_Connect_Command::getCommands();
         /**
          * @var $cmd Mage_Connect_Command
          */
         $cmd = Mage_Connect_Command::getInstance($command);
         if ($cmd instanceof Mage_Connect_Error) {
             return $cmd;
         }
         $this->_cmdCache[$command] = $cmd;
     } else {
         /**
          * @var $cmd Mage_Connect_Command
          */
         $cmd = $this->_cmdCache[$command];
     }
     $ftp = $this->getConfig()->remote_config;
     if (strlen($ftp) > 0) {
         $options = array_merge($options, array('ftp' => $ftp));
     }
     $cmd->run($command, $options, $params);
     if ($cmd->ui()->hasErrors()) {
         return false;
     } else {
         return true;
     }
 }