summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialVersion.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/specials/SpecialVersion.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/specials/SpecialVersion.php')
-rw-r--r--includes/specials/SpecialVersion.php74
1 files changed, 35 insertions, 39 deletions
diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php
index 8c8e386d..29f527f2 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -1,42 +1,37 @@
<?php
-/**#@+
+
+/**
* Give information about the version of MediaWiki, PHP, the DB and extensions
*
- * @file
* @ingroup SpecialPage
*
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
* @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
-
-/**
- * constructor
- */
-function wfSpecialVersion() {
- $version = new SpecialVersion;
- $version->execute();
-}
-
-/**
- * @ingroup SpecialPage
- */
-class SpecialVersion {
+class SpecialVersion extends SpecialPage {
private $firstExtOpened = true;
+ function __construct(){
+ parent::__construct( 'Version' );
+ }
+
/**
* main()
*/
- function execute() {
+ function execute( $par ) {
global $wgOut, $wgMessageCache, $wgSpecialVersionShowHooks;
$wgMessageCache->loadAllMessages();
+ $this->setHeaders();
+ $this->outputHeader();
+
$wgOut->addHTML( '<div dir="ltr">' );
$text =
$this->MediaWikiCredits() .
$this->softwareInformation() .
$this->extensionCredits();
- if ( $wgSpecialVersionShowHooks ) {
+ if ( $wgSpecialVersionShowHooks ) {
$text .= $this->wgHooks();
}
$wgOut->addWikiText( $text );
@@ -162,15 +157,21 @@ class SpecialVersion {
usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
foreach ( $wgExtensionCredits[$type] as $extension ) {
+ $version = null;
+ $subVersion = '';
if ( isset( $extension['version'] ) ) {
$version = $extension['version'];
- } elseif ( isset( $extension['svn-revision'] ) &&
+ }
+ if ( isset( $extension['svn-revision'] ) &&
preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
- $extension['svn-revision'], $m ) )
- {
- $version = 'r' . $m[1];
- } else {
- $version = null;
+ $extension['svn-revision'], $m ) ) {
+ $subVersion = 'r' . $m[1];
+ }
+
+ if( $version && $subVersion ) {
+ $version = $version . ' [' . $subVersion . ']';
+ } elseif ( !$version && $subVersion ) {
+ $version = $subVersion;
}
$out .= $this->formatCredits(
@@ -287,8 +288,6 @@ class SpecialVersion {
}
/**
- * @static
- *
* @return string
*/
function IPInfo() {
@@ -306,35 +305,34 @@ class SpecialVersion {
if ( $cnt == 1 ) {
// Enforce always returning a string
- return (string)$this->arrayToString( $list[0] );
+ return (string)self::arrayToString( $list[0] );
} elseif ( $cnt == 0 ) {
return '';
} else {
+ global $wgLang;
sort( $list );
- $t = array_slice( $list, 0, $cnt - 1 );
- $one = array_map( array( &$this, 'arrayToString' ), $t );
- $two = $this->arrayToString( $list[$cnt - 1] );
- $and = wfMsg( 'and' );
-
- return implode( ', ', $one ) . " $and $two";
+ return $wgLang->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
}
}
/**
- * @static
- *
* @param mixed $list Will convert an array to string if given and return
* the paramater unaltered otherwise
* @return mixed
*/
- function arrayToString( $list ) {
+ static function arrayToString( $list ) {
+ if( is_array( $list ) && count( $list ) == 1 )
+ $list = $list[0];
if( is_object( $list ) ) {
$class = get_class( $list );
return "($class)";
- } elseif ( ! is_array( $list ) ) {
+ } elseif ( !is_array( $list ) ) {
return $list;
} else {
- $class = get_class( $list[0] );
+ if( is_object( $list[0] ) )
+ $class = get_class( $list[0] );
+ else
+ $class = $list[0];
return "($class, {$list[1]})";
}
}
@@ -387,5 +385,3 @@ class SpecialVersion {
/**#@-*/
}
-
-/**#@-*/