// Fix table verification when drop DB is activated on new installer
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12198 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -87,7 +87,8 @@ class InstallControllerHttpDatabase extends InstallControllerHttp
|
|||||||
$this->session->database_login,
|
$this->session->database_login,
|
||||||
$this->session->database_password,
|
$this->session->database_password,
|
||||||
$this->session->database_prefix,
|
$this->session->database_prefix,
|
||||||
$this->session->database_engine
|
$this->session->database_engine,
|
||||||
|
$this->session->database_clear
|
||||||
);
|
);
|
||||||
|
|
||||||
return count($this->errors) ? false : true;
|
return count($this->errors) ? false : true;
|
||||||
@@ -112,8 +113,9 @@ class InstallControllerHttpDatabase extends InstallControllerHttp
|
|||||||
$password = Tools::getValue('dbPassword');
|
$password = Tools::getValue('dbPassword');
|
||||||
$prefix = Tools::getValue('db_prefix');
|
$prefix = Tools::getValue('db_prefix');
|
||||||
$engine = Tools::getValue('dbEngine');
|
$engine = Tools::getValue('dbEngine');
|
||||||
|
$clear = Tools::getValue('clear');
|
||||||
|
|
||||||
$errors = $this->model_database->testDatabaseSettings($server, $database, $login, $password, $prefix, $engine);
|
$errors = $this->model_database->testDatabaseSettings($server, $database, $login, $password, $prefix, $engine, $clear);
|
||||||
|
|
||||||
$this->ajaxJsonAnswer(
|
$this->ajaxJsonAnswer(
|
||||||
(count($errors)) ? false : true,
|
(count($errors)) ? false : true,
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ class InstallModelDatabase extends InstallAbstractModel
|
|||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $prefix
|
* @param string $prefix
|
||||||
* @param string $engine
|
* @param string $engine
|
||||||
|
* @param bool $clear
|
||||||
* @return array List of errors
|
* @return array List of errors
|
||||||
*/
|
*/
|
||||||
public function testDatabaseSettings($server, $database, $login, $password, $prefix, $engine)
|
public function testDatabaseSettings($server, $database, $login, $password, $prefix, $engine, $clear)
|
||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ class InstallModelDatabase extends InstallAbstractModel
|
|||||||
$errors[] = $this->language->l('Cannot convert database data to utf-8');
|
$errors[] = $this->language->l('Cannot convert database data to utf-8');
|
||||||
|
|
||||||
// Check if a table with same prefix already exists
|
// Check if a table with same prefix already exists
|
||||||
if (Db::hasTableWithSamePrefix($server, $login, $password, $database, $prefix))
|
if (!$clear && Db::hasTableWithSamePrefix($server, $login, $password, $database, $prefix))
|
||||||
$errors[] = $this->language->l('At least one table with same prefix was already found, please change your prefix or drop your database');
|
$errors[] = $this->language->l('At least one table with same prefix was already found, please change your prefix or drop your database');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ $(document).ready(function()
|
|||||||
'dbLogin': $('#dbLogin').val(),
|
'dbLogin': $('#dbLogin').val(),
|
||||||
'dbPassword': $('#dbPassword').val(),
|
'dbPassword': $('#dbPassword').val(),
|
||||||
'dbEngine': $('#dbEngine').val(),
|
'dbEngine': $('#dbEngine').val(),
|
||||||
'db_prefix': $('#db_prefix').val()
|
'db_prefix': $('#db_prefix').val(),
|
||||||
|
'clear': $('#db_clear').attr('checked') ? '1' : '0'
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: false,
|
cache: false,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function process_install(step)
|
|||||||
success: function(json)
|
success: function(json)
|
||||||
{
|
{
|
||||||
// No error during this step
|
// No error during this step
|
||||||
if (json.success)
|
if (json && json.success)
|
||||||
{
|
{
|
||||||
$('#process_step_'+step.key).show().addClass('success');
|
$('#process_step_'+step.key).show().addClass('success');
|
||||||
current_step++;
|
current_step++;
|
||||||
@@ -60,7 +60,7 @@ function process_install(step)
|
|||||||
// An error occured during this step
|
// An error occured during this step
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
install_error(step, json.message);
|
install_error(step, (json) ? json.message : '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// An error HTTP (page not found, json not valid, etc.) occured during this step
|
// An error HTTP (page not found, json not valid, etc.) occured during this step
|
||||||
|
|||||||
Reference in New Issue
Block a user