r49661 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49660‎ | r49661 | r49662 >
Date:13:05, 20 April 2009
Author:demon
Status:ok
Tags:
Comment:
(bug 18529) New hook: SoftwareInfo for adding information about the software to Special:Version
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1224,6 +1224,9 @@
12251225 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have been rendered (useful for adding more)
12261226 $tools: array of tools
12271227
 1228+'SoftwareInfo': Called by Special:Version for returning information about the software
 1229+$software: The array of software in format 'name' => 'version'. See SpecialVersion::softwareInformation()
 1230+
12281231 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
12291232 $id: User identifier
12301233
Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -80,25 +80,30 @@
8181 static function softwareInformation() {
8282 $dbr = wfGetDB( DB_SLAVE );
8383
84 - return Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
85 - Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) .
 84+ // Put the software in an array of form 'name' => 'version'. All messages should
 85+ // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
 86+ // can be used
 87+ $software = array();
 88+ $software['[http://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
 89+ $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
 90+ $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
 91+
 92+ // Allow a hook to add/remove items
 93+ wfRunHooks( 'SoftwareInfo', array( &$software ) );
 94+
 95+ $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
 96+ Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) .
8697 "<tr>
8798 <th>" . wfMsg( 'version-software-product' ) . "</th>
8899 <th>" . wfMsg( 'version-software-version' ) . "</th>
89 - </tr>\n
90 - <tr>
91 - <td>[http://www.mediawiki.org/ MediaWiki]</td>
92 - <td>" . self::getVersionLinked() . "</td>
93 - </tr>\n
94 - <tr>
95 - <td>[http://www.php.net/ PHP]</td>
96 - <td>" . phpversion() . " (" . php_sapi_name() . ")</td>
97 - </tr>\n
98 - <tr>
99 - <td>" . $dbr->getSoftwareLink() . "</td>
100 - <td>" . $dbr->getServerVersion() . "</td>
101 - </tr>\n" .
102 - Xml::closeElement( 'table' );
 100+ </tr>\n";
 101+ foreach( $software as $name => $version ) {
 102+ $out .= "<tr>
 103+ <td>" . $name . "</td>
 104+ <td>" . $version . "</td>
 105+ </tr>\n";
 106+ }
 107+ return $out . Xml::closeElement( 'table' );
103108 }
104109
105110 /**
Index: trunk/phase3/RELEASE-NOTES
@@ -167,6 +167,8 @@
168168 * Special:AllPages: Move hardcoded styles from code to CSS
169169 * (bug 6092) Add parser function equivalents of {{REVISIONID}},
170170 {{REVISIONTIMESTAMP}} (and friends) and {{REVISIONUSER}} magic words
 171+* (bug 18529) New hook: SoftwareInfo for adding information about the software
 172+ to Special:Version
171173
172174 === Bug fixes in 1.15 ===
173175 * (bug 16968) Special:Upload no longer throws useless warnings.

Status & tagging log