From 475d2e33ef667c10704ea405ab8a1075ed39758a Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Thu, 28 May 2026 10:54:28 -0500 Subject: [PATCH] fix(cli): updates_xml_build.php name prefix, SHA cascade, creationDate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use type-prefixed display name (e.g. "Package - MokoWaaS") in and fields instead of raw extension name - Cascade SHA-256 hash to ALL channel entries, not just the primary channel — all cascaded entries point to the same ZIP - Add to every entry for Joomla update schema compliance - Reorder XML fields to match Joomla conventions (client before version, tags after downloads) Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- cli/updates_xml_build.php | 52 ++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/cli/updates_xml_build.php b/cli/updates_xml_build.php index 714f7cb..1304c8d 100644 --- a/cli/updates_xml_build.php +++ b/cli/updates_xml_build.php @@ -224,6 +224,19 @@ if (empty($extType)) { $extType = 'component'; } +// Build display name with type prefix (e.g. "Package - MokoWaaS") +$typeDisplayMap = [ + 'package' => 'Package', + 'plugin' => 'Plugin', + 'module' => 'Module', + 'component' => 'Component', + 'template' => 'Template', + 'library' => 'Library', + 'file' => 'File', +]; +$typeDisplay = $typeDisplayMap[$extType] ?? ucfirst($extType); +$displayName = "{$typeDisplay} - {$extName}"; + // -- Build type prefix -------------------------------------------------------- $typePrefix = ''; switch ($extType) { @@ -333,7 +346,8 @@ function buildEntry( string $tagName, string $entryVersion, string $entryDownloadUrl, - string $extName, + string $displayName, + string $stabilityLabel, string $extElement, string $extType, string $clientTag, @@ -345,34 +359,33 @@ function buildEntry( ): string { $lines = []; $lines[] = ' '; - $lines[] = " {$extName}"; - $lines[] = " {$extName} update"; + $lines[] = " {$displayName}"; + $lines[] = " {$displayName} {$stabilityLabel} build."; // Element in updates.xml must match what Joomla stores in #__extensions // For packages: pkg_elementname. For plugins: elementname (folder handles grouping). $dbElement = ($extType === 'package') ? "pkg_{$extElement}" : $extElement; $lines[] = " {$dbElement}"; $lines[] = " {$extType}"; + $lines[] = $clientTag; $lines[] = " {$entryVersion}"; - if (!empty($clientTag)) { - $lines[] = $clientTag; - } + $lines[] = " " . date('Y-m-d') . ""; if (!empty($folderTag)) { $lines[] = $folderTag; } - $lines[] = " {$tagName}"; - $lines[] = " {$infoUrl}"; + $lines[] = " {$infoUrl}"; $lines[] = ' '; - $lines[] = " {$entryDownloadUrl}"; + $lines[] = " {$entryDownloadUrl}"; $lines[] = ' '; if (!empty($shaTag)) { $lines[] = $shaTag; } + $lines[] = " {$tagName}"; + $lines[] = ' Moko Consulting'; + $lines[] = ' https://mokoconsulting.tech'; $lines[] = " {$targetPlatform}"; if (!empty($phpTag)) { $lines[] = $phpTag; } - $lines[] = ' Moko Consulting'; - $lines[] = ' https://mokoconsulting.tech'; $lines[] = ' '; return implode("\n", $lines); } @@ -397,17 +410,26 @@ $channelVersion = $version . ($stabilitySuffixMap[$stability] ?? ''); $channelDownloadUrl = "{$giteaUrl}/{$org}/{$repo}/releases/download/{$giteaTag}/{$typePrefix}{$extElement}-{$channelVersion}.zip"; $channelInfoUrl = "{$giteaUrl}/{$org}/{$repo}/releases/tag/{$giteaTag}"; +// Stability labels for descriptions +$stabilityLabelMap = [ + 'stable' => 'stable', + 'rc' => 'rc', + 'beta' => 'beta', + 'alpha' => 'alpha', + 'development' => 'development', +]; + for ($i = 0; $i <= $stabilityIndex; $i++) { $channelName = $allChannels[$i]; $joomlaTag = $stabilityTagMap[$channelName] ?? $channelName; - // Only attach SHA to the primary channel entry - $entrySha = ($i === $stabilityIndex) ? $shaTag : ''; + $stabilityLabel = $stabilityLabelMap[$channelName] ?? $channelName; $entries[] = buildEntry( $joomlaTag, $channelVersion, $channelDownloadUrl, - $extName, + $displayName, + $stabilityLabel, $extElement, $extType, $clientTag, @@ -415,7 +437,7 @@ for ($i = 0; $i <= $stabilityIndex; $i++) { $channelInfoUrl, $targetPlatform, $phpTag, - $entrySha + $shaTag ); }