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 ); }