Commit bb368c69 authored by Gregory Roussac's avatar Gregory Roussac

[-] BO : #PSCSX-4479 Add check on htaccess before changing media servers

parent 954738d4
...@@ -817,11 +817,23 @@ class AdminPerformanceControllerCore extends AdminController ...@@ -817,11 +817,23 @@ class AdminPerformanceControllerCore extends AdminController
Configuration::updateValue('PS_MEDIA_SERVER_3', Tools::getValue('_MEDIA_SERVER_3_')); Configuration::updateValue('PS_MEDIA_SERVER_3', Tools::getValue('_MEDIA_SERVER_3_'));
Tools::clearSmartyCache(); Tools::clearSmartyCache();
Media::clearCache(); Media::clearCache();
if (is_writable(_PS_ROOT_DIR_.'/.htaccess'))
{
Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_'])); Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_']));
$redirectAdmin = true;
}
else
{
$message = $this->l('Before being able to use this tool, you need to:');
$message .= '<br />- '.$this->l('Create a blank .htaccess in your root directory.');
$message .= '<br />- '.$this->l('Give it write permissions (CHMOD 666 on Unix system).');
$this->errors[] = Tools::displayError($message, false);
Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', false);
}
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
$redirectAdmin = true;
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment