From 128f1de6c4ae2ffdd1ebb5ca48e6db784cdd4b64 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 5 Nov 2024 17:33:00 +0800 Subject: [PATCH] * [task#131483,doing,0.5h] Process upgrade relation for release and build. --- module/upgrade/model.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 6bf26c5121..71edd759a9 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -10356,6 +10356,40 @@ class upgradeModel extends model $relation->BID = $designID; $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); } + + /* Process release. */ + $releaseLinkedStories = $this->dao->select('id,stories')->from(TABLE_RELEASE)->where('stories')->ne('')->fetchPairs('id'); + foreach($releaseLinkedStories as $releaseID => $storyIdList) + { + foreach(explode(',', trim($storyIdList, ',')) as $storyID) + { + if(empty($storyID)) continue; + $relation = new stdClass(); + $relation->AType = 'story'; + $relation->AID = $storyID; + $relation->relation = 'interrated'; + $relation->BType = 'release'; + $relation->BID = $releaseID; + $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); + } + } + + /* Process build. */ + $buildLinkedStories = $this->dao->select('id,stories')->from(TABLE_BUILD)->where('stories')->ne('')->fetchPairs('id'); + foreach($buildLinkedStories as $buildID => $storyIdList) + { + foreach(explode(',', trim($storyIdList, ',')) as $storyID) + { + if(empty($storyID)) continue; + $relation = new stdClass(); + $relation->AType = 'story'; + $relation->AID = $storyID; + $relation->relation = 'interrated'; + $relation->BType = 'build'; + $relation->BID = $buildID; + $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); + } + } return true; } }