* adjust the install logic, check table exists or not instead of checking database.
This commit is contained in:
@@ -84,7 +84,7 @@ $lang->install->requestTypes['PATH_INFO'] = 'PATH_INFO';
|
||||
|
||||
$lang->install->errorConnectDB = 'Database connect failed.';
|
||||
$lang->install->errorCreateDB = 'Database create failed.';
|
||||
$lang->install->errorDBExists = 'Database alread exists, to continue install, check the clear db box.';
|
||||
$lang->install->errorTableExists = 'The same tables alread exists, to continue install, go back and check the clear db box.';
|
||||
$lang->install->errorCreateTable = 'Table create failed.';
|
||||
$lang->install->errorImportDemoData = 'Import demo data.';
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ $lang->install->requestTypes['PATH_INFO'] = '静态友好方式';
|
||||
|
||||
$lang->install->errorConnectDB = '数据库连接失败 ';
|
||||
$lang->install->errorCreateDB = '数据库创建失败';
|
||||
$lang->install->errorDBExists = '数据库已经存在,继续安装请选择清空数据';
|
||||
$lang->install->errorTableExists = '数据表已经存在,您之前应该有安装过禅道,继续安装请返回前页并选择清空数据';
|
||||
$lang->install->errorCreateTable = '创建表失败';
|
||||
$lang->install->errorImportDemoData = '导入demo数据失败';
|
||||
|
||||
|
||||
@@ -212,10 +212,10 @@ class installModel extends model
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
elseif($this->post->clearDB == false)
|
||||
elseif($this->tableExits() and $this->post->clearDB == false)
|
||||
{
|
||||
$return->result = 'fail';
|
||||
$return->error = $this->lang->install->errorDBExists;
|
||||
$return->error = $this->lang->install->errorTableExists;
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -282,6 +282,19 @@ class installModel extends model
|
||||
return $this->dbh->query($sql)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check table exits or not.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function tableExits()
|
||||
{
|
||||
$configTable = str_replace('`', "'", TABLE_CONFIG);
|
||||
$sql = "SHOW TABLES FROM {$this->config->db->name} like $configTable";
|
||||
return $this->dbh->query($sql)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mysql version.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user