* adjust the install logic, check table exists or not instead of checking database.

This commit is contained in:
wangchunsheng
2012-07-27 01:23:08 +00:00
parent 5c91d6998d
commit 7cf5d68a1c
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -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.';
+1 -1
View File
@@ -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数据失败';
+15 -2
View File
@@ -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.
*