/** * Clear cache command callback * @param string $command * @param array $options * @param array $params * @return void */ public function doClearCache($command, $options, $params) { $this->cleanupParams($params); try { $packager = new \Magento\Framework\Connect\Packager(); $ftp = empty($options['ftp']) ? false : $options['ftp']; if ($ftp) { list($cache, $ftpObj) = $packager->getRemoteCache($ftp); $cache->clear(); $packager->writeToRemoteCache($cache, $ftpObj); } else { $cache = $this->getSconfig(); $cache->clear(); } } catch (\Exception $e) { $this->doError($command, $e->getMessage()); } }
/** * 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; }