From d55d918b046f0f901d67750aff2d05edeb787a15 Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Sat, 5 Sep 2026 13:21:29 +0100 Subject: [PATCH] credits.php: Add package versions where available. And include versions for the pinc/3rdparty imports Useful for figuring out what's deployed to a sandbox. --- credits.php | 18 ++++++++++++++---- pinc/3rdparty/iconify/details.json | 5 +++-- pinc/3rdparty/mediawiki/details.json | 3 ++- styles/fonts/details.json | 6 ++++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/credits.php b/credits.php index cd62aecb0a..39d40e8ebc 100644 --- a/credits.php +++ b/credits.php @@ -31,7 +31,8 @@ public function __construct( public readonly string $name, public readonly string $license, public readonly ?string $url, - public readonly ?string $license_url + public readonly ?string $license_url, + public readonly ?string $version, ) { } } @@ -57,6 +58,10 @@ function output_credit_details(array $credit_details): void } else { echo html_safe($detail->name); } + // Only show the version if we're in testing mode. + if (SiteConfig::get()->testing && isset($detail->version)) { + echo " " . html_safe($detail->version); + } echo "
"; if (isset($detail->license_url)) { echo _("License") . ": " . html_safe($detail->license) . ""; @@ -71,12 +76,12 @@ function output_credit_details(array $credit_details): void /** @return array */ function load_bundled_credit_details(string $code_dir): array { - $credit_details = []; $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($code_dir), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD ); + $credit_details = []; foreach ($files as $file_info) { $file = $file_info->getPathname(); if (basename($file) != "details.json") { @@ -91,7 +96,8 @@ function load_bundled_credit_details(string $code_dir): array name: $detail["name"], url: $detail["url"] ?? null, license: $detail["license"], - license_url: $detail["license_url"] ?? null + license_url: $detail["license_url"] ?? null, + version: $detail["version"] ?? null ); } } @@ -106,12 +112,14 @@ function load_composer_credit_details() global $code_dir; $packages = json_decode(file_get_contents("$code_dir/composer.lock")); + $credit_details = []; foreach ($packages->packages as $index => $package) { $credit_details[$package->name] = new CreditDetails( name: $package->name, url: $package->homepage ?? null, license: join(", ", $package->license), - license_url: null + license_url: null, + version: $package->version ?? null ); } @@ -129,6 +137,7 @@ function load_npm_credit_details() $dependencies = array_keys($packages["packages"][""]["dependencies"]); // now pull the license details + $credit_details = []; foreach ($packages["packages"] as $name => $package) { $short_name = str_replace("node_modules/", "", $name); if (in_array($short_name, $dependencies)) { @@ -137,6 +146,7 @@ function load_npm_credit_details() url: null, license: $package["license"], license_url: null, + version: $package["version"] ?? null, ); } } diff --git a/pinc/3rdparty/iconify/details.json b/pinc/3rdparty/iconify/details.json index d6ab161395..a643437b24 100644 --- a/pinc/3rdparty/iconify/details.json +++ b/pinc/3rdparty/iconify/details.json @@ -3,5 +3,6 @@ "url": "https://iconify.design/", "license": "MIT License", "license_url": "https://github.com/primer/octicons/blob/main/LICENSE", - "license_file": "MIT_LICENSE" -} \ No newline at end of file + "license_file": "MIT_LICENSE", + "version": "v19.8.0" +} diff --git a/pinc/3rdparty/mediawiki/details.json b/pinc/3rdparty/mediawiki/details.json index 26127c52f8..1963ff6aa5 100644 --- a/pinc/3rdparty/mediawiki/details.json +++ b/pinc/3rdparty/mediawiki/details.json @@ -3,5 +3,6 @@ "url": "https://www.mediawiki.org/wiki/MediaWiki", "license": "GNU General Public License v2.0", "license_url": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html", - "license_file": "gpl-2.0.txt" + "license_file": "gpl-2.0.txt", + "version": "1.31.1" } diff --git a/styles/fonts/details.json b/styles/fonts/details.json index f63d62134e..5d179478c5 100644 --- a/styles/fonts/details.json +++ b/styles/fonts/details.json @@ -4,14 +4,16 @@ "url": "https://dejavu-fonts.github.io/", "license": "DejaVu Fonts license", "license_url": "https://dejavu-fonts.github.io/License.html", - "license_file": "DejaVu Fonts License.txt" + "license_file": "DejaVu Fonts License.txt", + "version": "2.37" }, { "name": "DP Sans Mono", "url": "https://www.pgdp.net/wiki/DP_Sans_Mono", "license": "DP Sans Mono license", "license_url": "https://www.pgdp.net/wiki/DP_Sans_Mono#License", - "license_file": "DP Sans Mono License.txt" + "license_file": "DP Sans Mono License.txt", + "version": "Draft 17" }, { "name": "EB Garamond",