/** * Validate the SFTP configurations and set the response body to a JSON * response including the success of the test connection and any messages to * be displayed to the user. * @return self */ public function validatesftpAction() { $request = $this->getRequest(); $configMap = Mage::getModel('eb2ccore/config'); $host = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_HOSTNAME_PARAM, self::SFTP_HOSTNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_location')); $username = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_USERNAME_PARAM, self::SFTP_USERNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_username')); $port = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_PORT_PARAM, self::SFTP_PORT_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_port')); $key = $this->_validatorHelper->getSftpPrivateKey($request, self::SFTP_PRIV_KEY_PARAM, self::SFTP_PRIV_KEY_USE_DEFAULT_PARAM, Mage::getSingleton('eb2ccore/config')->getPathForKey('sftp_private_key')); $this->getResponse()->setHeader('Content-Type', 'text/json')->setBody(json_encode(Mage::helper('eb2ccore/validator')->testSftpConnection($host, $username, $key, $port))); return $this; }