From: Chad Horohoe Date: Mon, 20 Apr 2009 13:05:15 +0000 (+0000) Subject: (bug 18529) New hook: SoftwareInfo for adding information about the software to Speci... X-Git-Tag: 1.31.0-rc.0~42096 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=5a64151ed2efa19c2fe09cd17e1e548953af59c6;p=lhc%2Fweb%2Fwiklou.git (bug 18529) New hook: SoftwareInfo for adding information about the software to Special:Version --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7fa8aae9fc..4ef8d69911 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -167,6 +167,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Special:AllPages: Move hardcoded styles from code to CSS * (bug 6092) Add parser function equivalents of {{REVISIONID}}, {{REVISIONTIMESTAMP}} (and friends) and {{REVISIONUSER}} magic words +* (bug 18529) New hook: SoftwareInfo for adding information about the software + to Special:Version === Bug fixes in 1.15 === * (bug 16968) Special:Upload no longer throws useless warnings. diff --git a/docs/hooks.txt b/docs/hooks.txt index 11a62edb33..054fc82c5e 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1224,6 +1224,9 @@ $content_actions: array of tabs 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have been rendered (useful for adding more) $tools: array of tools +'SoftwareInfo': Called by Special:Version for returning information about the software +$software: The array of software in format 'name' => 'version'. See SpecialVersion::softwareInformation() + 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions $id: User identifier diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index a3324c6e66..9a795619f8 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -80,25 +80,30 @@ class SpecialVersion extends SpecialPage { static function softwareInformation() { $dbr = wfGetDB( DB_SLAVE ); - return Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) . - Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) . + // Put the software in an array of form 'name' => 'version'. All messages should + // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup + // can be used + $software = array(); + $software['[http://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked(); + $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")"; + $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion(); + + // Allow a hook to add/remove items + wfRunHooks( 'SoftwareInfo', array( &$software ) ); + + $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) . + Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) . " " . wfMsg( 'version-software-product' ) . " " . wfMsg( 'version-software-version' ) . " - \n - - [http://www.mediawiki.org/ MediaWiki] - " . self::getVersionLinked() . " - \n - - [http://www.php.net/ PHP] - " . phpversion() . " (" . php_sapi_name() . ") - \n - - " . $dbr->getSoftwareLink() . " - " . $dbr->getServerVersion() . " - \n" . - Xml::closeElement( 'table' ); + \n"; + foreach( $software as $name => $version ) { + $out .= " + " . $name . " + " . $version . " + \n"; + } + return $out . Xml::closeElement( 'table' ); } /**