From 651e619bb3ff74a0ad29bb8412556d6845a13350 Mon Sep 17 00:00:00 2001 From: ECYaz Date: Mon, 3 Aug 2026 19:04:00 -0400 Subject: [PATCH 1/2] Update each branch's release topic from its own latest revision --- includes/objects/contribution.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/includes/objects/contribution.php b/includes/objects/contribution.php index 47d45a10e..23d77b03c 100644 --- a/includes/objects/contribution.php +++ b/includes/objects/contribution.php @@ -1221,17 +1221,30 @@ public function update_release_topic() $contrib_description = $this->contrib_desc; message::decode($contrib_description, $this->contrib_desc_uid); - $download = reset($this->download); // Just need the first download entry - $phpbb_versions = $this->revisions[$download['revision_id']]['phpbb_versions']; - foreach ($phpbb_versions as $phpbb_version) + // Each branch has its own latest download and its own release topic. + foreach ($this->download as $branch => $download) { - $branch = (int)$phpbb_version['phpbb_version_branch']; - if (empty($this->type->forum_database[$branch])) { continue; } + // The revision row for this branch carries the tested phpBB version. + $phpbb_version = false; + foreach ($this->revisions[$download['revision_id']]['phpbb_versions'] as $version_row) + { + if ((int) $version_row['phpbb_version_branch'] == $branch) + { + $phpbb_version = $version_row; + break; + } + } + + if ($phpbb_version === false) + { + continue; + } + $u_download = $this->controller_helper->route('phpbb.titania.download', array( 'id' => $download['attachment_id'] )); From 42524429f158ea9d5e910b0bf141aae7f941f9e7 Mon Sep 17 00:00:00 2001 From: ECYaz Date: Tue, 4 Aug 2026 17:07:17 -0400 Subject: [PATCH 2/2] Keep every branch in the download list A revision that is the latest for several branches collapsed to a single entry when the list was keyed through array_flip, so consumers indexing by branch lost every branch but one: the release topic loop skipped a branch's topic, the demo box dropped a branch, and the version check reported one branch only. The list now carries one entry per branch, revisions shared between branches are shown once in the download details, and the approved branches fallback resolves branches without the flip. --- includes/objects/contribution.php | 35 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/includes/objects/contribution.php b/includes/objects/contribution.php index 23d77b03c..df5b81608 100644 --- a/includes/objects/contribution.php +++ b/includes/objects/contribution.php @@ -536,13 +536,22 @@ public function get_download($revision_id = false) (($revision_id === false) ? ' AND r.revision_status = ' . ext::TITANIA_REVISION_APPROVED : '') . ' AND revision_submitted = 1'; $result = phpbb::$db->sql_query($sql); - $revisions = array_flip($revisions); + $rows = array(); while ($row = phpbb::$db->sql_fetchrow($result)) { - $this->download[$revisions[$row['revision_id']]] = $row; + $rows[(int) $row['revision_id']] = $row; } phpbb::$db->sql_freeresult($result); + + // Branches sharing one latest revision each keep their own entry. + foreach ($revisions as $branch => $branch_revision_id) + { + if (isset($rows[$branch_revision_id])) + { + $this->download[$branch] = $rows[$branch_revision_id]; + } + } krsort($this->download); } } @@ -898,8 +907,16 @@ public function assign_download_details() titania::$config->colorizeit . '.html?sample=' . $this->clr_sample->get_id(); } + $displayed = array(); foreach ($this->download as $download) { + // A revision latest for several branches gets one download block. + if (isset($displayed[$download['revision_id']])) + { + continue; + } + $displayed[$download['revision_id']] = true; + $vendor_version = $install_level = $install_time = $u_colorizeit = ''; if (!empty($this->revisions[$download['revision_id']]['phpbb_versions'])) @@ -1078,17 +1095,21 @@ public function get_approved_branches() AND revision_status = ' . ext::TITANIA_REVISION_APPROVED . ' AND revision_submitted = 1'; $result = phpbb::$db->sql_query($sql); - $revisions = array_flip($revisions); // revision_id => branch - $approved = array(); + $approved_revisions = array(); while ($row = phpbb::$db->sql_fetchrow($result)) { - $branch = (int) $revisions[(int) $row['revision_id']]; - if (isset($allowed_branches[$branch])) + $approved_revisions[(int) $row['revision_id']] = true; + } + phpbb::$db->sql_freeresult($result); + + $approved = array(); + foreach ($revisions as $branch => $branch_revision_id) + { + if (isset($approved_revisions[$branch_revision_id]) && isset($allowed_branches[$branch])) { $approved[$branch] = $allowed_branches[$branch]; } } - phpbb::$db->sql_freeresult($result); return $approved; }