+ parseubb to bug steps and userTPL when upgrade.

This commit is contained in:
fujia
2010-09-13 09:50:25 +00:00
parent f3edef3a90
commit cd7a847fc4
3 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -454,7 +454,7 @@ class bugModel extends model
public function saveUserBugTemplate()
{
$template = fixer::input('post')
->specialChars('title, content')
->specialChars('title')
->add('account', $this->app->user->account)
->add('type', 'bug')
->get();
+1 -1
View File
@@ -30,7 +30,7 @@ KE.plugin.savetemplate = {
function setTemplate(templateID)
{
$('#tplTitleBox' + templateID).attr('style', 'text-decoration:underline; color:#8B008B');
steps = $('#template' + templateID).text();
steps = $('#template' + templateID).html();
KE.html('steps', steps);
}
+19
View File
@@ -293,6 +293,7 @@ class upgradeModel extends model
private function upgradeFrom1_2To1_3()
{
$this->execSQL($this->getUpgradeFile('1.2'));
$this->updateUbb();
if(!$this->isError()) $this->setting->updateVersion('1.3');
}
@@ -317,6 +318,24 @@ class upgradeModel extends model
}
}
/* 更新bug表的steps字段和userTPL表的content字段。*/
private function updateUbb()
{
$bugs = $this->dao->select('id, steps')->from(TABLE_BUG)->fetchAll();
$userTemplates = $this->dao->select('id, content')->from(TABLE_USERTPL)->fetchAll();
foreach($bugs as $id => $bug)
{
$bug->steps = html::parseUBB($bug->steps);
$this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bug->id)->exec();
}
foreach($userTemplates as $template)
{
$template->content = html::parseUBB($template->content);
$this->dao->update(TABLE_USERTPL)->data($template)->where('id')->eq($template->id)->exec();
}
}
/* 获得要更新的sql文件。*/
private function getUpgradeFile($version)
{