X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialVersion.php;h=6ad02f0026b2c2aaaac528d5941a1a621a282598;hb=70987ee4c08d0c19468f67d7482d5bd150a0ad39;hp=ec34db861133982f64a1ab9bf50b7f2594605b8d;hpb=0dda44c8e7e54ab897447954d5c4174513ce7586;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index ec34db8611..6ad02f0026 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -31,13 +31,20 @@ use MediaWiki\MediaWikiServices; * @ingroup SpecialPage */ class SpecialVersion extends SpecialPage { + + /** + * @var bool + */ protected $firstExtOpened = false; /** - * Stores the current rev id/SHA hash of MediaWiki core + * @var string The current rev id/SHA hash of MediaWiki core */ protected $coreId = ''; + /** + * @var string[]|false Lazy initialized key/value with message content + */ protected static $extensionTypes = false; public function __construct() { @@ -379,7 +386,7 @@ class SpecialVersion extends SpecialPage { * * @since 1.17 * - * @return array + * @return string[] */ public static function getExtensionTypes() { if ( self::$extensionTypes === false ) { @@ -981,7 +988,27 @@ class SpecialVersion extends SpecialPage { $linkRenderer = $this->getLinkRenderer(); $list = []; - foreach ( (array)$authors as $item ) { + $authors = (array)$authors; + + // Special case: if the authors array has only one item and it is "...", + // it should not be rendered as the "version-poweredby-others" i18n msg, + // but rather as "version-poweredby-various" i18n msg instead. + if ( count( $authors ) === 1 && $authors[0] === '...' ) { + // Link to the extension's or skin's AUTHORS or CREDITS file, if there is + // such a file; otherwise just return the i18n msg as-is + if ( $extName && $this->getExtAuthorsFileName( $extDir ) ) { + return $linkRenderer->makeLink( + $this->getPageTitle( "Credits/$extName" ), + $this->msg( 'version-poweredby-various' )->text() + ); + } else { + return $this->msg( 'version-poweredby-various' )->escaped(); + } + } + + // Otherwise, if we have an actual array that has more than one item, + // process each array item as usual + foreach ( $authors as $item ) { if ( $item == '...' ) { $hasOthers = true;