X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialVersion.php;h=6ad02f0026b2c2aaaac528d5941a1a621a282598;hb=25242105e8fd03c9900250bdf9ea91be9a286625;hp=5456ce78617e41d493d30179edd5600f64906c31;hpb=427d803a670c60be0c42edece9ab724600b0d46c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 5456ce7861..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() { @@ -219,23 +226,26 @@ class SpecialVersion extends SpecialPage { } /** - * Returns wiki text showing the third party software versions (apache, php, mysql). + * @since 1.34 * - * @return string + * @return array */ - public static function softwareInformation() { + public static function getSoftwareInformation() { $dbr = wfGetDB( DB_REPLICA ); // Put the software in an array of form 'name' => 'version'. All messages should // be loaded here, so feel free to use wfMessage in the 'name'. Raw HTML or // wikimarkup can be used. - $software = []; - $software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked(); + $software = [ + '[https://www.mediawiki.org/ MediaWiki]' => self::getVersionLinked() + ]; + if ( wfIsHHVM() ) { $software['[https://hhvm.com/ HHVM]'] = HHVM_VERSION . " (" . PHP_SAPI . ")"; } else { $software['[https://php.net/ PHP]'] = PHP_VERSION . " (" . PHP_SAPI . ")"; } + $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo(); if ( defined( 'INTL_ICU_VERSION' ) ) { @@ -245,18 +255,27 @@ class SpecialVersion extends SpecialPage { // Allow a hook to add/remove items. Hooks::run( 'SoftwareInfo', [ &$software ] ); + return $software; + } + + /** + * Returns HTML showing the third party software versions (apache, php, mysql). + * + * @return string HTML table + */ + public static function softwareInformation() { $out = Xml::element( 'h2', [ 'id' => 'mw-version-software' ], wfMessage( 'version-software' )->text() ) . - Xml::openElement( 'table', [ 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ] ) . - " - " . wfMessage( 'version-software-product' )->text() . " - " . wfMessage( 'version-software-version' )->text() . " - \n"; + Xml::openElement( 'table', [ 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ] ) . + " + " . wfMessage( 'version-software-product' )->text() . " + " . wfMessage( 'version-software-version' )->text() . " + \n"; - foreach ( $software as $name => $version ) { + foreach ( self::getSoftwareInformation() as $name => $version ) { $out .= " " . $name . " " . $version . " @@ -367,7 +386,7 @@ class SpecialVersion extends SpecialPage { * * @since 1.17 * - * @return array + * @return string[] */ public static function getExtensionTypes() { if ( self::$extensionTypes === false ) { @@ -969,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;