* add the feature of checkconfig.
This commit is contained in:
@@ -37,31 +37,64 @@ class convert extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 转换参数设置。*/
|
||||
public function setConfig()
|
||||
{
|
||||
if(!$this->post->source)
|
||||
{
|
||||
echo js::alert($this->lang->convert->mustSelectSource);
|
||||
die(js::locate('back'));
|
||||
}
|
||||
list($sourceName, $version) = explode('_', $this->post->source);
|
||||
$setFunc = "set$sourceName";
|
||||
$this->view->header->title = 'setting';
|
||||
$this->view->header->title = $this->lang->convert->setting;
|
||||
$this->view->source = $sourceName;
|
||||
$this->view->setting = $this->fetch('convert', $setFunc, "version=$version");
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* BugFree的设置界面。*/
|
||||
public function setBugFree($version)
|
||||
{
|
||||
$this->view->source = 'BugFree';
|
||||
$this->view->version = $version;
|
||||
$this->view->source = 'BugFree';
|
||||
$this->view->version = $version;
|
||||
$this->view->tablePrefix = $version > 1 ? 'bf' : '';
|
||||
$this->view->dbName = 'BugFree';
|
||||
$this->view->dbName = 'BugFree';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 检查配置。*/
|
||||
public function checkConfig()
|
||||
{
|
||||
$checkFunc = 'check' . $this->post->source;
|
||||
$this->view->header->title = $this->lang->convert->checkConfig;
|
||||
$this->view->source = $this->post->source;
|
||||
$this->view->checkResult = $this->fetch('convert', $checkFunc, "version={$this->post->version}");
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 检查BugFree的设置。*/
|
||||
public function checkBugFree($version)
|
||||
{
|
||||
helper::import('./converter/bugfree.php');
|
||||
$converter = new bugfreeConvertModel();
|
||||
$checkResult['connectDB'] = $converter->connectDB();
|
||||
$checkResult['checkTables'] = $converter->checkTables();
|
||||
$checkResult['checkRoot'] = $converter->checkRoot();
|
||||
a($checkResult);
|
||||
$this->view->source = 'bugfree';
|
||||
$this->view->version = $version;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 执行转换。*/
|
||||
public function execute()
|
||||
{
|
||||
$convertFunc = 'convert' . $this->post->source;
|
||||
$this->$convertFunc($this->post->version);
|
||||
}
|
||||
|
||||
/* 转换BugFree。*/
|
||||
public function convertBugFree($version)
|
||||
{
|
||||
helper::import('./converter/bugfree.php');
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
<?php
|
||||
class bugfreeConvertModel extends convertModel
|
||||
{
|
||||
/* <20><><EFBFBD><EFBFBD>Tables<65><73>*/
|
||||
public function checkTables()
|
||||
{
|
||||
}
|
||||
|
||||
/* <20><><EFBFBD>鰲װ·<D7B0><C2B7><EFBFBD><EFBFBD>*/
|
||||
public function checkInstallRoot()
|
||||
{
|
||||
}
|
||||
|
||||
/* ִ<><D6B4>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>*/
|
||||
public function execute()
|
||||
{
|
||||
$this->clear();
|
||||
|
||||
@@ -33,69 +33,31 @@ $lang->convert->desc = <<<EOT
|
||||
<strong>转换存在一定的风险,转换之前,我们强烈建议您备份数据库及相应的数据文件,并保证转换的时候,没有其他人进行操作。</strong>
|
||||
EOT;
|
||||
|
||||
$lang->convert->selectSource = '选择来源系统及版本';
|
||||
$lang->convert->source = '来源系统';
|
||||
$lang->convert->version = '版本';
|
||||
$lang->convert->selectSource = '选择来源系统及版本';
|
||||
$lang->convert->source = '来源系统';
|
||||
$lang->convert->version = '版本';
|
||||
$lang->convert->mustSelectSource = "必须选择一个来源。";
|
||||
|
||||
$lang->convert->sourceList['BugFree'] = array('bugfree_1' => '1.x');
|
||||
$lang->convert->sourceList['Mantis'] = array('mantis_1' => '1.x');
|
||||
|
||||
$lang->convert->setting = '进入设置页面';
|
||||
$lang->convert->setting = '设置';
|
||||
$lang->convert->checkConfig = '检查配置';
|
||||
|
||||
$lang->convert->checking = '系统检查';
|
||||
$lang->convert->ok = '检查通过(√)';
|
||||
$lang->convert->fail = '检查失败(×)';
|
||||
$lang->convert->loaded = '已加载';
|
||||
$lang->convert->unloaded = '未加载';
|
||||
$lang->convert->exists = '目录存在 ';
|
||||
$lang->convert->notExists = '目录不存在 ';
|
||||
$lang->convert->writable = '目录可写 ';
|
||||
$lang->convert->notWritable= '目录不可写 ';
|
||||
$lang->convert->phpINI = 'PHP配置文件';
|
||||
$lang->convert->checkItem = '检查项';
|
||||
$lang->convert->current = '当前配置';
|
||||
$lang->convert->result = '检查结果';
|
||||
$lang->convert->action = '如何修改';
|
||||
|
||||
$lang->convert->phpVersion = 'PHP版本';
|
||||
$lang->convert->phpFail = 'PHP版本必须大于5.2.0';
|
||||
|
||||
$lang->convert->pdo = 'PDO扩展';
|
||||
$lang->convert->pdoFail = '修改PHP配置文件,加载PDO扩展。';
|
||||
$lang->convert->pdoMySQL = 'PDO_MySQL扩展';
|
||||
$lang->convert->pdoMySQLFail = '修改PHP配置文件,加载pdo_mysql扩展。';
|
||||
$lang->convert->tmpRoot = '临时文件目录';
|
||||
$lang->convert->dataRoot = '上传文件目录';
|
||||
$lang->convert->mkdir = '<p>需要创建目录%s。<br /> linux下面命令为:<br /> mkdir -p %s</p>';
|
||||
$lang->convert->chmod = '需要修改目录 "%s" 的权限。<br />linux下面命令为:<br />chmod o=rwx -R %s';
|
||||
|
||||
$lang->convert->settingDB = '设置数据库';
|
||||
$lang->convert->settingDB = '设置数据库';
|
||||
$lang->convert->dbHost = '数据库服务器';
|
||||
$lang->convert->dbPort = '服务器端口';
|
||||
$lang->convert->dbUser = '数据库用户名';
|
||||
$lang->convert->dbPassword = '数据库密码';
|
||||
$lang->convert->dbName = '%s使用的库';
|
||||
$lang->convert->dbPrefix = '%s表前缀';
|
||||
$lang->convert->clearDB = '清空现有数据';
|
||||
$lang->convert->installRoot= '%s安装的根目录';
|
||||
|
||||
$lang->convert->errorConnectDB = '数据库连接失败 ';
|
||||
$lang->convert->errorCreateDB = '数据库创建失败';
|
||||
$lang->convert->errorCreateTable = '创建表失败';
|
||||
|
||||
$lang->convert->setConfig = '生成配置文件';
|
||||
$lang->convert->key = '配置项';
|
||||
$lang->convert->value = '值';
|
||||
$lang->convert->saveConfig = '保存配置文件';
|
||||
$lang->convert->save2File = '拷贝上面文本框中的内容,将其保存到 " %s "中。';
|
||||
$lang->convert->errorNotSaveConfig = '还没有保存配置文件';
|
||||
|
||||
$lang->convert->getPriv = '设置帐号';
|
||||
$lang->convert->company = '公司名称';
|
||||
$lang->convert->pms = 'PMS地址';
|
||||
$lang->convert->pmsNote = '即通过什么地址可以访问到禅道项目管理,设置域名或者IP地址即可,不需要http';
|
||||
$lang->convert->account = '管理员帐号';
|
||||
$lang->convert->password = '管理员密码';
|
||||
$lang->convert->errorEmptyPassword = '密码不能为空';
|
||||
|
||||
$lang->convert->success = "安装成功!请删除convert.php,登录禅道管理系统,设置用户及分组!";
|
||||
|
||||
|
||||
@@ -25,12 +25,6 @@
|
||||
<?php
|
||||
class convertModel extends model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->connectDB();
|
||||
}
|
||||
|
||||
/* 连接到数据库。*/
|
||||
public function connectDB()
|
||||
{
|
||||
@@ -42,6 +36,7 @@ class convertModel extends model
|
||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbh->exec("SET NAMES UTF8");
|
||||
$this->sourceDBH = $dbh;
|
||||
return $dbh;
|
||||
}
|
||||
catch (PDOException $exception)
|
||||
{
|
||||
|
||||
5
trunk/module/convert/view/checkbugfree.html.php
Normal file
5
trunk/module/convert/view/checkbugfree.html.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->convert->dbHost;?></th>
|
||||
<td><?php echo html::input('dbHost', 'localhost');?></td>
|
||||
</tr>
|
||||
<?php echo html::hidden('source', $source) . html::hidden('version', $version);?>
|
||||
35
trunk/module/convert/view/checkconfig.html.php
Normal file
35
trunk/module/convert/view/checkconfig.html.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* The html template file of check config method of convert module of ZenTaoMS.
|
||||
*
|
||||
* ZenTaoMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ZenTaoMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @copyright Copyright: 2009 Chunsheng Wang
|
||||
* @author Chunsheng Wang <wwccss@263.net>
|
||||
* @package convert
|
||||
* @version $Id$
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<div class='yui-d0'>
|
||||
<table align='center' class='table-5 f-14px'>
|
||||
<caption><?php echo $lang->convert->checkConfig . $lang->colon . strtoupper($source);?></caption>
|
||||
<?php echo $checkResult;?>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/footer.html.php';?>
|
||||
@@ -37,7 +37,7 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton($lang->convert->setting);?></td>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->convert->dbHost;?></th>
|
||||
<th class='rowhead w-200px'><?php echo $lang->convert->dbHost;?></th>
|
||||
<td><?php echo html::input('dbHost', 'localhost');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->convert->dbPort;?></th>
|
||||
<th class='rowhead'><?php echo $lang->convert->dbPort;?></th>
|
||||
<td><?php echo html::input('dbPort', '3306');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->convert->dbUser;?></th>
|
||||
<th class='rowhead'><?php echo $lang->convert->dbUser;?></th>
|
||||
<td><?php echo html::input('dbUser', 'root');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->convert->dbPassword;?></th>
|
||||
<th class='rowhead'><?php echo $lang->convert->dbPassword;?></th>
|
||||
<td><?php echo html::input('dbPassword');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php printf($lang->convert->dbName, $source);?></th>
|
||||
<th class='rowhead'><?php printf($lang->convert->dbName, $source);?></th>
|
||||
<td><?php echo html::input('dbName', $dbName);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php printf($lang->convert->dbPrefix, $source);?></th>
|
||||
<th class='rowhead'><?php printf($lang->convert->dbPrefix, $source);?></th>
|
||||
<td><?php echo html::input('dbPrefix', $tablePrefix);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php printf($lang->convert->installRoot, $source);?></th>
|
||||
<td><?php echo html::input('installRoot');?></td>
|
||||
</tr>
|
||||
<?php echo html::hidden('source', $source) . html::hidden('version', $version);?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* The html template file of select source method of convert module of ZenTaoMS.
|
||||
* The html template file of setconfig method of convert module of ZenTaoMS.
|
||||
*
|
||||
* ZenTaoMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -23,9 +23,9 @@
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' action='<?php echo inlink('execute');?>'>
|
||||
<form method='post' action='<?php echo inlink('checkconfig');?>'>
|
||||
<table align='center' class='table-5 f-14px'>
|
||||
<caption><?php echo $source;?></caption>
|
||||
<caption><?php echo $lang->convert->setting . $lang->colon . strtoupper($source);?></caption>
|
||||
<?php echo $setting;?>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton();?></td>
|
||||
|
||||
Reference in New Issue
Block a user