* adjust code for updateActivatedCountOfBug in upgrade model.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-10-31 00:14:57 +00:00
parent dd06f854c3
commit 519fbbd2c2
+10 -7
View File
@@ -854,14 +854,17 @@ class upgradeModel extends model
private function updateActivatedCountOfBug()
{
$bugActivatedActions = $this->dao->select('*')->from(TABLE_ACTION)->where('action')->eq('activated')->andWhere('objectType')->eq('bug')->fetchAll();
foreach($bugActivatedActions as $action)
if(!empty($bugActivatedActions))
{
if(!isset($counts[$action->objectID])) $counts[$action->objectID] = 0;
$counts[$action->objectID] ++;
}
foreach($counts as $key => $count)
{
$this->dao->update(TABLE_BUG)->set('activatedCount')->eq($count)->where('id')->eq($key)->exec();
foreach($bugActivatedActions as $action)
{
if(!isset($counts[$action->objectID])) $counts[$action->objectID] = 0;
$counts[$action->objectID] ++;
}
foreach($counts as $key => $count)
{
$this->dao->update(TABLE_BUG)->set('activatedCount')->eq($count)->where('id')->eq($key)->exec();
}
}
}