(bug 18529) New hook: SoftwareInfo for adding information about the software to Special:Version

This commit is contained in:
Chad Horohoe 2009-04-20 13:05:15 +00:00
parent 6199813086
commit 5a64151ed2
3 changed files with 26 additions and 16 deletions

View 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.

View 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

View 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' );
}
/**