* Add a new function named execDMSQL.

This commit is contained in:
songchenxuan
2023-06-13 14:33:53 +08:00
parent 30dc1395ee
commit 853ccb4e07
2 changed files with 16 additions and 2 deletions
+2
View File
@@ -239,6 +239,8 @@ class install extends control
{ {
if(!empty($_POST)) if(!empty($_POST))
{ {
if($this->config->db->driver == 'dm') $this->install->execDMSQL();
$this->install->grantPriv(); $this->install->grantPriv();
if(dao::isError()) return print(js::error(dao::getError())); if(dao::isError()) return print(js::error(dao::getError()));
+14 -2
View File
@@ -393,8 +393,6 @@ class installModel extends model
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql'; $dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql';
$tables = explode(';', file_get_contents($dbFile)); $tables = explode(';', file_get_contents($dbFile));
if($this->config->db->driver == 'dm') $tables = array_merge($tables, explode(';', file_get_contents($this->app->getAppRoot() . 'db' . DS . 'dm.sql')));
foreach($tables as $table) foreach($tables as $table)
{ {
$table = trim($table); $table = trim($table);
@@ -436,6 +434,20 @@ class installModel extends model
return true; return true;
} }
/**
* Exec dm.sql.
*
* @access public
* @return bool
*/
public function execDMSQL()
{
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'dm.sql';
$tables = explode(';', file_get_contents($dbFile));
foreach($tables as $table) $this->dbh->exec($table);
}
/** /**
* Create a comapny, set admin. * Create a comapny, set admin.
* *