(bug 18529) New hook: SoftwareInfo for adding information about the software to Speci...
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 20 Apr 2009 13:05:15 +0000 (13:05 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 20 Apr 2009 13:05:15 +0000 (13:05 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/specials/SpecialVersion.php

index 7fa8aae..4ef8d69 100644 (file)
@@ -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.
index 11a62ed..054fc82 100644 (file)
@@ -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
 
index a3324c6..9a79561 100644 (file)
@@ -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' ) ) .
                                "<tr>
                                        <th>" . wfMsg( 'version-software-product' ) . "</th>
                                        <th>" . wfMsg( 'version-software-version' ) . "</th>
-                               </tr>\n
-                               <tr>
-                                       <td>[http://www.mediawiki.org/ MediaWiki]</td>
-                                       <td>" . self::getVersionLinked() . "</td>
-                               </tr>\n
-                               <tr>
-                                       <td>[http://www.php.net/ PHP]</td>
-                                       <td>" . phpversion() . " (" . php_sapi_name() . ")</td>
-                               </tr>\n
-                               <tr>
-                                       <td>" . $dbr->getSoftwareLink() . "</td>
-                                       <td>" . $dbr->getServerVersion() . "</td>
-                               </tr>\n" .
-                       Xml::closeElement( 'table' );
+                               </tr>\n";
+               foreach( $software as $name => $version ) {
+                       $out .= "<tr>
+                                       <td>" . $name . "</td>
+                                       <td>" . $version . "</td>
+                               </tr>\n";
+               }               
+               return $out . Xml::closeElement( 'table' );
        }
 
        /**