* Add import bi data in step 5.
This commit is contained in:
@@ -382,6 +382,8 @@ class install extends control
|
||||
/* Update created date of metrics. */
|
||||
$this->loadModel('metric')->updateMetricDate();
|
||||
|
||||
$this->install->importBIData();
|
||||
|
||||
$skipApp = (string)getenv('ZT_SKIP_DEVOPS_INIT');
|
||||
$link = ($this->config->inQuickon && (!$skipApp || $skipApp == 'false')) ? inlink('app') : inlink('step6');
|
||||
return $this->send(array('result' => 'success', 'load' => $link));
|
||||
|
||||
@@ -107,6 +107,8 @@ class installModel extends model
|
||||
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql';
|
||||
$tables = explode(';', file_get_contents($dbFile));
|
||||
|
||||
|
||||
|
||||
foreach($tables as $table)
|
||||
{
|
||||
$table = trim($table);
|
||||
@@ -371,4 +373,42 @@ class installModel extends model
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入BI内置数据。
|
||||
* Import BI data.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function importBIData()
|
||||
{
|
||||
$this->loadModel('bi');
|
||||
|
||||
/* Prepare built-in sqls of bi. */
|
||||
$chartSQLs = $this->bi->prepareBuiltinChartSQL();
|
||||
$pivotSQLs = $this->bi->prepareBuiltinPivotSQL();
|
||||
|
||||
$insertTables = array_merge($chartSQLs, $pivotSQLs);
|
||||
|
||||
try
|
||||
{
|
||||
foreach($insertTables as $table)
|
||||
{
|
||||
$table = trim($table);
|
||||
if(empty($table)) continue;
|
||||
|
||||
$table = str_replace('`zt_', $this->config->db->name . '.`zt_', $table);
|
||||
$table = str_replace('zt_', $this->config->db->prefix, $table);
|
||||
if(!$this->dbh->query($table)) return false;
|
||||
}
|
||||
}
|
||||
catch(Error $e)
|
||||
{
|
||||
a($e->getMessage());
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user