3 * Give information about the version of MediaWiki, PHP, the DB and extensions
6 * @subpackage SpecialPage
10 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
11 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
12 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
18 function wfSpecialVersion() {
19 $version = new SpecialVersion
;
23 class SpecialVersion
{
33 function SpecialVersion() {
34 // English motherfucker, do you speak it?
35 $this->langObj
= setupLangObj( 'LanguageEn' );
36 $this->langObj
->initEncoding();
46 $this->MediaWikiCredits() .
47 $this->extensionCredits() .
50 $wgOut->addHTML( $this->IPInfo() );
60 function MediaWikiCredits() {
63 $dbr =& wfGetDB( DB_SLAVE
);
68 This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
69 copyright (C) 2001-2006 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
70 Tim Starling, Erik Möller, and others.
72 MediaWiki is free software; you can redistribute it and/or modify
73 it under the terms of the GNU General Public License as published by
74 the Free Software Foundation; either version 2 of the License, or
75 (at your option) any later version.
77 MediaWiki is distributed in the hope that it will be useful,
78 but WITHOUT ANY WARRANTY; without even the implied warranty of
79 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80 GNU General Public License for more details.
82 You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU General Public License]
83 along with this program; if not, write to the Free Software
84 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
85 or [http://www.gnu.org/copyleft/gpl.html read it online]
87 * [http://www.mediawiki.org/ MediaWiki]: $wgVersion
88 * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ")
89 * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion() . "
92 return str_replace( "\t\t", '', $ret );
95 function extensionCredits() {
96 global $wgExtensionCredits, $wgExtensionFunctions, $wgParser, $wgSkinExtensionFunction;
98 if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunction ) )
101 $extensionTypes = array(
102 'specialpage' => 'Special pages',
103 'parserhook' => 'Parser hooks',
104 'variable' => 'Variables',
107 wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
109 $out = "\n* Extensions:\n";
110 foreach ( $extensionTypes as $type => $text ) {
111 if ( count( @$wgExtensionCredits[$type] ) ) {
112 $out .= "** $text:\n";
114 usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
116 foreach ( $wgExtensionCredits[$type] as $extension ) {
117 wfSuppressWarnings();
118 $out .= $this->formatCredits(
120 $extension['version'],
121 $extension['author'],
123 $extension['description']
130 if ( count( $wgExtensionFunctions ) ) {
131 $out .= "** Extension functions:\n";
132 $out .= '***' . $this->langObj
->listToText( $wgExtensionFunctions ) . "\n";
135 if ( $cnt = count( $tags = $wgParser->getTags() ) ) {
136 for ( $i = 0; $i < $cnt; ++
$i )
137 $tags[$i] = "<{$tags[$i]}>";
138 $out .= "** Parser extension tags:\n";
139 $out .= '***' . $this->langObj
->listToText( $tags ). "\n";
142 if ( count( $wgSkinExtensionFunction ) ) {
143 $out .= "** Skin extension functions:\n";
144 $out .= '***' . $this->langObj
->listToText( $wgSkinExtensionFunction ) . "\n";
150 function compare( $a, $b ) {
151 if ( $a['name'] === $b['name'] )
154 return $this->langObj
->lc( $a['name'] ) > $this->langObj
->lc( $b['name'] ) ?
1 : -1;
157 function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) {
162 if ( isset( $version ) )
163 $ret .= " (version $version)";
167 if ( isset( $description ) )
168 $ret .= ', ' . $description;
169 if ( isset( $description ) && isset( $author ) )
171 if ( isset( $author ) )
172 $ret .= ' by ' . $this->langObj
->listToText( (array)$author );
180 $myWgHooks = $wgHooks;
184 foreach ($myWgHooks as $hook => $hooks)
185 $ret .= "** $hook:" . $this->langObj
->listToText( $hooks ) . "\n";
194 $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
195 return "<!-- visited from $ip -->\n";