From ace5db002378ca8b3ff63a66ba5ab35267754b9f Mon Sep 17 00:00:00 2001 From: Ricordisamoa Date: Sat, 3 Jan 2015 15:16:39 +0100 Subject: [PATCH] Always use the canonical extension name to link the license file Items in $wgExtensionCredits can expose a 'namemsg' attribute, but it should only be used for localized strings. SpecialVersion->execute() correctly uses 'name', while commit 326f3f450ce56420090e3bb30eb9a9cccfe1816e inadvertently made getCreditsForExtension() use 'namemsg'. Also reduced code duplication. Change-Id: I029ea17c55191d74bc6a803fad6cf092105f5b3c --- includes/specials/SpecialVersion.php | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 3747e923d3..7df9efea70 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -788,24 +788,23 @@ class SpecialVersion extends SpecialPage { // ... and license information; if a license file exists we // will link to it $licenseLink = ''; - if ( isset( $extension['license-name'] ) ) { - $licenseLink = Linker::link( - $this->getPageTitle( 'License/' . $extensionName ), - $out->parseInline( $extension['license-name'] ), - array( - 'class' => 'mw-version-ext-license', - 'dir' => 'auto', - ) - ); - } elseif ( $this->getExtLicenseFileName( $extensionPath ) ) { - $licenseLink = Linker::link( - $this->getPageTitle( 'License/' . $extensionName ), - $this->msg( 'version-ext-license' ), - array( - 'class' => 'mw-version-ext-license', - 'dir' => 'auto', - ) - ); + if ( isset( $extension['name'] ) ) { + $licenseName = null; + if ( isset( $extension['license-name'] ) ) { + $licenseName = $out->parseInline( $extension['license-name'] ); + } elseif ( $this->getExtLicenseFileName( $extensionPath ) ) { + $licenseName = $this->msg( 'version-ext-license' ); + } + if ( $licenseName !== null ) { + $licenseLink = Linker::link( + $this->getPageTitle( 'License/' . $extension['name'] ), + $licenseName, + array( + 'class' => 'mw-version-ext-license', + 'dir' => 'auto', + ) + ); + } } // ... and generate the description; which can be a parameterized l10n message -- 2.20.1