* fix the error of convert from bugfree.
This commit is contained in:
@@ -62,6 +62,7 @@ class convert extends control
|
||||
$this->view->version = $version;
|
||||
$this->view->tablePrefix = $version > 1 ? 'bf_' : '';
|
||||
$this->view->dbName = $version > 1 ? 'bugfree2' : 'BugFree';
|
||||
$this->view->dbCharset = 'utf8';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -131,17 +131,17 @@ class bugfree1ConvertModel extends bugfreeConvertModel
|
||||
->dbh($this->sourceDBH)
|
||||
->select(
|
||||
'moduleID AS id,
|
||||
projectID AS product,
|
||||
projectID AS root,
|
||||
moduleName AS name,
|
||||
moduleGrade AS grade,
|
||||
parentID AS parent,
|
||||
"bug" AS view')
|
||||
"bug" AS type')
|
||||
->from('BugModule')
|
||||
->orderBy('id ASC')
|
||||
->fetchAll('id', $autoCompany = false);
|
||||
foreach($modules as $moduleID => $module)
|
||||
{
|
||||
$module->product = $this->map['product'][$module->product];
|
||||
$module->root = $this->map['product'][$module->root];
|
||||
unset($module->id);
|
||||
$this->dao->dbh($this->dbh)->insert(TABLE_MODULE)->data($module)->exec();
|
||||
$this->map['module'][$moduleID] = $this->dao->lastInsertID();
|
||||
|
||||
@@ -37,6 +37,7 @@ class bugfree2ConvertModel extends bugfreeConvertModel
|
||||
$result['results'] = $this->convertResult();
|
||||
$result['actions'] = $this->convertAction();
|
||||
$result['files'] = $this->convertFile();
|
||||
$this->dao->dbh($this->dbh);
|
||||
$this->loadModel('tree')->fixModulePath();
|
||||
return $result;
|
||||
}
|
||||
@@ -140,8 +141,8 @@ class bugfree2ConvertModel extends bugfreeConvertModel
|
||||
->dbh($this->sourceDBH)
|
||||
->select(
|
||||
'moduleID AS id,
|
||||
moduleType as view,
|
||||
projectID AS product,
|
||||
moduleType as type,
|
||||
projectID AS root,
|
||||
moduleName AS name,
|
||||
moduleGrade AS grade,
|
||||
parentID AS parent,
|
||||
@@ -151,8 +152,8 @@ class bugfree2ConvertModel extends bugfreeConvertModel
|
||||
->fetchAll('id', $autoCompany = false);
|
||||
foreach($modules as $moduleID => $module)
|
||||
{
|
||||
$module->product = $this->map['product'][$module->product];
|
||||
$module->view = strtolower($module->view);
|
||||
$module->root = $this->map['product'][$module->root];
|
||||
$module->type = strtolower($module->type);
|
||||
unset($module->id);
|
||||
$this->dao->dbh($this->dbh)->insert(TABLE_MODULE)->data($module)->exec();
|
||||
$this->map['module'][$moduleID] = $this->dao->lastInsertID();
|
||||
|
||||
@@ -53,6 +53,7 @@ $lang->convert->dbPort = 'Server port';
|
||||
$lang->convert->dbUser = 'Database user';
|
||||
$lang->convert->dbPassword = 'Database password';
|
||||
$lang->convert->dbName = '%s database';
|
||||
$lang->convert->dbCharset = '%s charset';
|
||||
$lang->convert->dbPrefix = '%s table prefix';
|
||||
$lang->convert->installPath= '%s installed path';
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ $lang->convert->dbPort = '服务器端口';
|
||||
$lang->convert->dbUser = '数据库用户名';
|
||||
$lang->convert->dbPassword = '数据库密码';
|
||||
$lang->convert->dbName = '%s使用的库';
|
||||
$lang->convert->dbCharset = '%s数据库编码';
|
||||
$lang->convert->dbPrefix = '%s表前缀';
|
||||
$lang->convert->installPath= '%s安装的根目录';
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class convertModel extends model
|
||||
$dbh = new PDO($dsn, $this->post->dbUser, $this->post->dbPassword);
|
||||
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
|
||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbh->exec("SET NAMES UTF8");
|
||||
$dbh->exec("SET NAMES {$this->post->dbCharset}");
|
||||
$this->sourceDBH = $dbh;
|
||||
return $dbh;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
echo html::hidden('dbUser', $this->post->dbUser);
|
||||
echo html::hidden('dbPassword', $this->post->dbPassword);
|
||||
echo html::hidden('dbName', $this->post->dbName);
|
||||
echo html::hidden('dbCharset', $this->post->dbCharset);
|
||||
echo html::hidden('dbPrefix', $this->post->dbPrefix);
|
||||
echo html::hidden('installPath',$this->post->installPath);
|
||||
?>
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
<th class='rowhead'><?php printf($lang->convert->dbName, $source);?></th>
|
||||
<td><?php echo html::input('dbName', $dbName, "class='text-3'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php printf($lang->convert->dbCharset, $source);?></th>
|
||||
<td><?php echo html::input('dbCharset', $dbCharset, "class='text-3'");?></td>
|
||||
</tr>
|
||||
<?php if($version > 1):?>
|
||||
<tr>
|
||||
<th class='rowhead'><?php printf($lang->convert->dbPrefix, $source);?></th>
|
||||
|
||||
Reference in New Issue
Block a user