Пример #1
0
 /**
  * Retrieve object of config
  *
  * @return \Magento\Framework\Connect\Config
  */
 public function config()
 {
     if (!$this->_config) {
         $this->_config = $this->model('connect', true)->connect()->getConfig();
         if (!$this->_config->isLoaded()) {
             $this->session()->addMessage('error', "Settings has not been loaded. Used default settings");
             if ($this->_config->getError()) {
                 $this->session()->addMessage('error', $this->_config->getError());
             }
         }
     }
     return $this->_config;
 }
Пример #2
0
 /**
  * Retrieve object of config and set it to \Magento\Framework\Connect\Command
  *
  * @return \Magento\Framework\Connect\Config
  */
 public function getConfig()
 {
     if (!$this->_config) {
         $this->_config = new \Magento\Framework\Connect\Config();
         $ftp = $this->_config->__get('remote_config');
         if (!empty($ftp)) {
             $packager = new \Magento\Framework\Connect\Packager();
             list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
             $this->_config = $config;
             $this->_sconfig = $cache;
         }
         $this->_config->magento_root = dirname(__DIR__) . '/..';
         \Magento\Framework\Connect\Command::setConfigObject($this->_config);
     }
     return $this->_config;
 }
Пример #3
0
 /**
  * Return global file mode in octal representation
  *
  * @param \Magento\Framework\Connect\Config $config
  * @return int
  */
 protected function _getFileMode($config)
 {
     if ($this->validPermMode($config->global_file_mode)) {
         return $config->global_file_mode;
     } else {
         return $config->getDefaultValue('global_file_mode');
     }
 }
Пример #4
0
 /**
  * @param string $ftpString
  * @return \Magento\Framework\Object[]
  */
 public function getRemoteConfig($ftpString)
 {
     $ftpObj = new Ftp();
     $ftpObj->connect($ftpString);
     $cfgFile = "connect.cfg";
     $wd = $ftpObj->getcwd();
     $remoteConfigExists = $ftpObj->fileExists($cfgFile);
     $tempConfigFile = uniqid($cfgFile . "_temp");
     if (!$remoteConfigExists) {
         $remoteCfg = new Config($tempConfigFile);
         $remoteCfg->store();
         $ftpObj->upload($cfgFile, $tempConfigFile);
     } else {
         $ftpObj->get($tempConfigFile, $cfgFile);
         $remoteCfg = new Config($tempConfigFile);
     }
     $ftpObj->chdir($wd);
     return array($remoteCfg, $ftpObj);
 }