From: Ricordisamoa Date: Sat, 3 Jan 2015 14:16:39 +0000 (+0100) Subject: Always use the canonical extension name to link the license file X-Git-Tag: 1.31.0-rc.0~12787^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=ace5db002378ca8b3ff63a66ba5ab35267754b9f;p=lhc%2Fweb%2Fwiklou.git 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 --- 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