From 519fbbd2c2ac66aa56e0c351c2ad0500afd30474 Mon Sep 17 00:00:00 2001 From: "shiyangyangwork@yahoo.cn" Date: Mon, 31 Oct 2011 00:14:57 +0000 Subject: [PATCH] * adjust code for updateActivatedCountOfBug in upgrade model. --- module/upgrade/model.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index c09eddf5d3..28159fb231 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -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(); + } } }