diff --git a/module/install/lang/en.php b/module/install/lang/en.php index 48dc64e705..7adb1c502b 100644 --- a/module/install/lang/en.php +++ b/module/install/lang/en.php @@ -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.'; diff --git a/module/install/lang/zh-cn.php b/module/install/lang/zh-cn.php index 2b6c36f72e..7990f48424 100644 --- a/module/install/lang/zh-cn.php +++ b/module/install/lang/zh-cn.php @@ -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数据失败'; diff --git a/module/install/model.php b/module/install/model.php index 3310c59041..377412593a 100644 --- a/module/install/model.php +++ b/module/install/model.php @@ -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. *