Created
April 23, 2013 13:37
-
-
Save m4tthumphrey/5443603 to your computer and use it in GitHub Desktop.
One of the worst parts of Magento. Truly hilarious. It checks that a URL returns the string 'MAGENTO' and nothing else as a way to check that it has been installed to the correct place. Impossible to test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function _checkUrl($url, $secure = false) | |
{ | |
$prefix = $secure ? 'install/wizard/checkSecureHost/' : 'install/wizard/checkHost/'; | |
try { | |
$client = new Varien_Http_Client($url . 'index.php/' . $prefix); | |
$response = $client->request('GET'); | |
/* @var $responce Zend_Http_Response */ | |
$body = $response->getBody(); | |
} | |
catch (Exception $e){ | |
$this->_getInstaller()->getDataModel() | |
->addError(Mage::helper('install')->__('The URL "%s" is not accessible.', $url)); | |
throw $e; | |
} | |
if ($body != Mage_Install_Model_Installer::INSTALLER_HOST_RESPONSE) { | |
$this->_getInstaller()->getDataModel() | |
->addError(Mage::helper('install')->__('The URL "%s" is invalid.', $url)); | |
Mage::throwException(Mage::helper('install')->__('Response from server isn\'t valid.')); | |
} | |
return $this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment