From 547fc5ead87583ce3e20233fecb788cf714c17b4 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 30 May 2026 19:50:11 -0500 Subject: [PATCH] fix: sort updates.xml entries dev first, stable last [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Joomla reads entries top-down. Sorting dev→alpha→beta→rc→stable ensures proper display ordering in the Joomla update manager. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- cli/updates_xml_build.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/updates_xml_build.php b/cli/updates_xml_build.php index 93b8f11..3d8b94c 100644 --- a/cli/updates_xml_build.php +++ b/cli/updates_xml_build.php @@ -458,6 +458,15 @@ $output = << XML; $allEntries = array_merge($preservedEntries, $entries); + +// Sort entries: dev first, stable last +$stabilityOrder = ['dev' => 0, 'development' => 0, 'alpha' => 1, 'beta' => 2, 'rc' => 3, 'stable' => 4]; +usort($allEntries, function ($a, $b) use ($stabilityOrder) { + preg_match('/([^<]+)<\/tag>/', $a, $ma); + preg_match('/([^<]+)<\/tag>/', $b, $mb); + return ($stabilityOrder[$ma[1] ?? ''] ?? 99) - ($stabilityOrder[$mb[1] ?? ''] ?? 99); +}); + $output .= "\n" . implode("\n", $allEntries) . "\n\n"; $dest = $outputFile ?? "{$root}/updates.xml";