From 6fec4e3fdee76a551d7d50b95f05dd35f2128494 Mon Sep 17 00:00:00 2001
From: Tim Starling
Date: Sun, 15 May 2011 13:21:16 +0000
Subject: [PATCH] Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION
etc.): breaks HipHop support.
---
api.php | 10 ++-----
includes/DefaultSettings.php | 17 ++---------
includes/Defines.php | 28 ++++++++-----------
includes/Export.php | 3 +-
includes/Feed.php | 7 +++--
includes/GlobalFunctions.php | 6 ++--
includes/HttpFunctions.php | 3 +-
includes/OutputPage.php | 4 +--
includes/Setup.php | 1 -
includes/installer/DatabaseUpdater.php | 3 +-
includes/installer/Installer.php | 7 ++---
includes/installer/MysqlInstaller.php | 6 ++--
includes/installer/OracleInstaller.php | 6 ++--
includes/installer/WebInstallerOutput.php | 3 +-
.../ResourceLoaderStartUpModule.php | 4 +--
includes/specials/SpecialVersion.php | 21 +++++++-------
index.php | 15 +++++-----
load.php | 10 ++-----
maintenance/Maintenance.php | 9 ++----
maintenance/install.php | 10 ++-----
maintenance/update.php | 8 ++----
tests/parserTests.php | 3 +-
22 files changed, 78 insertions(+), 106 deletions(-)
diff --git a/api.php b/api.php
index 1d12e03f09..f55f85361a 100644
--- a/api.php
+++ b/api.php
@@ -37,9 +37,6 @@
// So extensions (and other code) can check whether they're running in API mode
define( 'MW_API', true );
-// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( __FILE__ ) . '/includes/Defines.php' );
-
// We want a plain message on catastrophic errors that machines can identify
function wfDie( $msg = '' ) {
header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
@@ -48,10 +45,9 @@ function wfDie( $msg = '' ) {
}
// Die on unsupported PHP versions
-if( !function_exists( 'version_compare' ) || version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ){
- $version = htmlspecialchars( MW_VERSION );
- $phpversion = htmlspecialchars( MW_MIN_PHP_VERSION );
- wfDie( "MediaWiki $version requires at least PHP version $phpversion." );
+if( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ){
+ $version = htmlspecialchars( $wgVersion );
+ wfDie( "MediaWiki $version requires at least PHP version 5.2.3." );
}
// Initialise common code.
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index a04550bbe5..1a4ef3097c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -33,11 +33,8 @@ if ( !defined( 'MW_COMPILED' ) ) {
$wgConf = new SiteConfiguration;
/** @endcond */
-/**
- * MediaWiki version number
- * @deprecated use the constant MW_VERSION instead
- */
-$wgVersion = MW_VERSION;
+/** MediaWiki version number */
+$wgVersion = '1.19alpha';
/** Name of the site. It must be changed in LocalSettings.php */
$wgSitename = 'MediaWiki';
@@ -4345,16 +4342,6 @@ $wgUseNPPatrol = true;
/** Provide syndication feeds (RSS, Atom) for, e.g., Recentchanges, Newpages */
$wgFeed = true;
-/**
- * Available feeds objects
- * Should probably only be defined when a page is syndicated ie when
- * $wgOut->isSyndicated() is true
- */
-$wgFeedClasses = array(
- 'rss' => 'RSSFeed',
- 'atom' => 'AtomFeed',
-);
-
/** Set maximum number of results to return in syndication feeds (RSS, Atom) for
* eg Recentchanges, Newpages. */
$wgFeedLimit = 50;
diff --git a/includes/Defines.php b/includes/Defines.php
index 770f569d4c..b4a8d7b41d 100644
--- a/includes/Defines.php
+++ b/includes/Defines.php
@@ -1,8 +1,6 @@
isSyndicated() is true
+ */
+$wgFeedClasses = array(
+ 'rss' => 'RSSFeed',
+ 'atom' => 'AtomFeed',
+);
+
/**@{
* Cache type
*/
diff --git a/includes/Export.php b/includes/Export.php
index 2c8a7487fd..0dbba91876 100644
--- a/includes/Export.php
+++ b/includes/Export.php
@@ -406,7 +406,8 @@ class XmlDumpWriter {
}
function generator() {
- return Xml::element( 'generator', array(), "MediaWiki " . MW_VERSION );
+ global $wgVersion;
+ return Xml::element( 'generator', array(), "MediaWiki $wgVersion" );
}
function homelink() {
diff --git a/includes/Feed.php b/includes/Feed.php
index 8535eaa393..183b8e6e59 100644
--- a/includes/Feed.php
+++ b/includes/Feed.php
@@ -301,6 +301,7 @@ class RSSFeed extends ChannelFeed {
* Ouput an RSS 2.0 header
*/
function outHeader() {
+ global $wgVersion;
$this->outXmlHeader();
?>
@@ -309,7 +310,7 @@ class RSSFeed extends ChannelFeed {
getUrl() ?>
getDescription() ?>
getLanguage() ?>
- MediaWiki
+ MediaWiki
formatTime( wfTimestampNow() ) ?>
outXmlHeader();
?>
getFeedId() ?>
@@ -368,7 +371,7 @@ class AtomFeed extends ChannelFeed {
formatTime( wfTimestampNow() ) ?>Z
getDescription() ?>
- MediaWiki
+ MediaWiki
'generator',
- 'content' => "MediaWiki " . MW_VERSION,
+ 'content' => "MediaWiki $wgVersion",
) );
$p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
diff --git a/includes/Setup.php b/includes/Setup.php
index e3be061c85..3ca8b2c099 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -23,7 +23,6 @@ $fname = 'Setup.php';
wfProfileIn( $fname );
// Check to see if we are at the file scope
-// FIXME: use a different test here, maybe a constant defined at the top of DefaultSettings.php?
if ( !isset( $wgVersion ) ) {
echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
die( 1 );
diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php
index fa4d74a5b5..01ff69042d 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -191,6 +191,7 @@ abstract class DatabaseUpdater {
* @param $what Array: what updates to perform
*/
public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) {
+ global $wgVersion;
$what = array_flip( $what );
if ( isset( $what['core'] ) ) {
@@ -201,7 +202,7 @@ abstract class DatabaseUpdater {
$this->runUpdates( $this->getExtensionUpdates(), true );
}
- $this->setAppliedUpdates( MW_VERSION, $this->updates );
+ $this->setAppliedUpdates( $wgVersion, $this->updates );
if( isset( $what['purge'] ) ) {
$this->purgeCache();
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 50867bcefc..7cd2983c66 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -24,8 +24,7 @@
abstract class Installer {
// This is the absolute minimum PHP version we can support
- // @deprecated since 1.18
- const MINIMUM_PHP_VERSION = MW_MIN_PHP_VERSION;
+ const MINIMUM_PHP_VERSION = '5.2.3';
/**
* @var array
@@ -379,11 +378,11 @@ abstract class Installer {
*/
public function doEnvironmentChecks() {
$phpVersion = phpversion();
- if( version_compare( $phpVersion, MW_MIN_PHP_VERSION, '>=' ) ) {
+ if( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
$this->showMessage( 'config-env-php', $phpVersion );
$good = true;
} else {
- $this->showMessage( 'config-env-php-toolow', $phpVersion, MW_MIN_PHP_VERSION );
+ $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
$good = false;
}
diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php
index fb96e3208e..5046df3bd0 100644
--- a/includes/installer/MysqlInstaller.php
+++ b/includes/installer/MysqlInstaller.php
@@ -31,6 +31,8 @@ class MysqlInstaller extends DatabaseInstaller {
public $supportedEngines = array( 'InnoDB', 'MyISAM' );
+ public $minimumVersion = '4.0.14';
+
public $webUserPrivs = array(
'DELETE',
'INSERT',
@@ -102,8 +104,8 @@ class MysqlInstaller extends DatabaseInstaller {
// Check version
$version = $conn->getServerVersion();
- if ( version_compare( $version, MW_MIN_MYSQL_VERSION ) < 0 ) {
- return Status::newFatal( 'config-mysql-old', MW_MIN_MYSQL_VERSION, $version );
+ if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
+ return Status::newFatal( 'config-mysql-old', $this->minimumVersion, $version );
}
return $status;
diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php
index 77442a669b..85758301bd 100644
--- a/includes/installer/OracleInstaller.php
+++ b/includes/installer/OracleInstaller.php
@@ -26,6 +26,8 @@ class OracleInstaller extends DatabaseInstaller {
'_OracleDefTS' => 'USERS',
'_OracleTempTS' => 'TEMP'
);
+
+ public $minimumVersion = '9.0.1'; // 9iR1
protected $connError = null;
@@ -118,8 +120,8 @@ class OracleInstaller extends DatabaseInstaller {
// Check version
$version = $conn->getServerVersion();
- if ( version_compare( $version, MW_MIN_ORACLE_VERSION ) < 0 ) {
- return Status::newFatal( 'config-oracle-old', MW_MIN_ORACLE_VERSION, $version );
+ if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
+ return Status::newFatal( 'config-oracle-old', $this->minimumVersion, $version );
}
return $status;
diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php
index 7366888d13..443cf5ab40 100644
--- a/includes/installer/WebInstallerOutput.php
+++ b/includes/installer/WebInstallerOutput.php
@@ -270,7 +270,8 @@ class WebInstallerOutput {
}
public function outputTitle() {
- echo htmlspecialchars( wfMsg( 'config-title', MW_VERSION ) );
+ global $wgVersion;
+ echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
}
public function getJQuery() {
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php
index b63d4df1dd..29c4645a3c 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -35,7 +35,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
protected function getConfig( $context ) {
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension,
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
- $wgVariantArticlePath, $wgActionPaths, $wgUseAjax,
+ $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest,
$wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgProto,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgLegacyJavaScriptGlobals;
@@ -71,7 +71,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
- 'wgVersion' => MW_VERSION,
+ 'wgVersion' => $wgVersion,
'wgEnableAPI' => $wgEnableAPI,
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(),
diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php
index 3a8bdc2051..53c5e876e4 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -159,16 +159,16 @@ class SpecialVersion extends SpecialPage {
* @return mixed
*/
public static function getVersion( $flags = '' ) {
- global $IP;
+ global $wgVersion, $IP;
wfProfileIn( __METHOD__ );
$info = self::getSvnInfo( $IP );
if ( !$info ) {
- $version = MW_VERSION;
+ $version = $wgVersion;
} elseif( $flags === 'nodb' ) {
- $version = MW_VERSION . " (r{$info['checkout-rev']})";
+ $version = "$wgVersion (r{$info['checkout-rev']})";
} else {
- $version = MW_VERSION . ' ' .
+ $version = $wgVersion . ' ' .
wfMsg(
'version-svn-revision',
isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
@@ -187,13 +187,11 @@ class SpecialVersion extends SpecialPage {
* @return mixed
*/
public static function getVersionLinked() {
- global $IP;
+ global $wgVersion, $IP;
wfProfileIn( __METHOD__ );
$info = self::getSvnInfo( $IP );
- $version = MW_VERSION;
-
if ( isset( $info['checkout-rev'] ) ) {
$linkText = wfMsg(
'version-svn-revision',
@@ -202,10 +200,12 @@ class SpecialVersion extends SpecialPage {
);
if ( isset( $info['viewvc-url'] ) ) {
- $version .= " [{$info['viewvc-url']} $linkText]";
+ $version = "$wgVersion [{$info['viewvc-url']} $linkText]";
} else {
- $version .= " $linkText";
+ $version = "$wgVersion $linkText";
}
+ } else {
+ $version = $wgVersion;
}
wfProfileOut( __METHOD__ );
@@ -681,10 +681,9 @@ class SpecialVersion extends SpecialPage {
function showEasterEgg() {
$rx = $rp = $xe = '';
- $version = MW_VERSION;
$alpha = array("", "kbQW", "\$\n()");
$beta = implode( "', '", $alpha);
- $juliet = 'echo $delta + strrev($foxtrot) - $alfa + $version . base64_decode($bravo) * $charlie';
+ $juliet = 'echo $delta + strrev($foxtrot) - $alfa + $wgVersion . base64_decode($bravo) * $charlie';
for ( $i = 1; $i <= 4; $i++ ) {
$rx .= '([^j]*)J';
$rp .= "+(\\$i)";
diff --git a/index.php b/index.php
index d203f755a6..ff50131e3d 100644
--- a/index.php
+++ b/index.php
@@ -36,18 +36,14 @@
* @file
*/
-// Load global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( __FILE__ ) . '/includes/Defines.php' );
-
// Bail on old versions of PHP. Pretty much every other file in the codebase
// has structures (try/catch, foo()->bar(), etc etc) which throw parse errors in PHP 4.
// Setup.php and ObjectCache.php have structures invalid in PHP 5.0 and 5.1, respectively.
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ) {
$phpversion = htmlspecialchars( phpversion() );
- $reqVersion = htmlspecialchars( MW_MIN_PHP_VERSION );
$errorMsg = <<
- MediaWiki requires PHP $reqVersion or higher. You are running PHP $phpversion.
+ MediaWiki requires PHP 5.2.3 or higher. You are running PHP $phpversion.
Please consider upgrading your copy of PHP.
@@ -164,8 +160,11 @@ $mediaWiki->restInPeace();
* @param $errorMsg String fully-escaped HTML
*/
function wfDie( $errorMsg ){
- global $wgLogo;
- $version = htmlspecialchars( MW_VERSION );
+ // Use the version set in DefaultSettings if possible, but don't rely on it
+ global $wgVersion, $wgLogo;
+ $version = isset( $wgVersion ) && $wgVersion
+ ? htmlspecialchars( $wgVersion )
+ : '';
$logo = isset( $wgLogo ) && $wgLogo
? $wgLogo
: 'http://upload.wikimedia.org/wikipedia/commons/1/1c/MediaWiki_logo.png';
diff --git a/load.php b/load.php
index ff6d9d7fef..7fff7c4991 100644
--- a/load.php
+++ b/load.php
@@ -30,14 +30,10 @@ function wfDie( $msg = '' ) {
die( 1 );
}
-// Load global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( __FILE__ ) . '/includes/Defines.php' );
-
// Die on unsupported PHP versions
-if( !function_exists( 'version_compare' ) || version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ){
- $version = htmlspecialchars( MW_VERSION );
- $phpversion = htmlspecialchars( MW_MIN_PHP_VERSION );
- wfDie( "MediaWiki $version requires at least PHP version $phpversion." );
+if( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ){
+ $version = htmlspecialchars( $wgVersion );
+ wfDie( "MediaWiki $version requires at least PHP version 5.2.3." );
}
require ( dirname( __FILE__ ) . '/includes/WebStart.php' );
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index db32201199..9d4da81873 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -20,9 +20,6 @@
* @defgroup Maintenance Maintenance
*/
-// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( dirname( __FILE__ ) ) . '/includes/Defines.php' );
-
// Define this so scripts can easily find doMaintenance.php
define( 'RUN_MAINTENANCE_IF_MAIN', dirname( __FILE__ ) . '/doMaintenance.php' );
define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
@@ -30,10 +27,10 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
$maintClass = false;
// Make sure we're on PHP5 or better
-if ( version_compare( PHP_VERSION, MW_MIN_PHP_VERSION ) < 0 ) {
- die ( "Sorry! This version of MediaWiki requires PHP " . MW_MIN_PHP_VERSION . "; you are running " .
+if ( version_compare( PHP_VERSION, '5.2.3' ) < 0 ) {
+ die ( "Sorry! This version of MediaWiki requires PHP 5.2.3; you are running " .
PHP_VERSION . ".\n\n" .
- "If you are sure you already have PHP " . MW_MIN_PHP_VERSION . " or higher installed, it may be\n" .
+ "If you are sure you already have PHP 5.2.3 or higher installed, it may be\n" .
"installed in a different path from PHP " . PHP_VERSION . ". Check with your system\n" .
"administrator.\n" );
}
diff --git a/maintenance/install.php b/maintenance/install.php
index a1ac9f0c9f..57e669d178 100644
--- a/maintenance/install.php
+++ b/maintenance/install.php
@@ -20,13 +20,9 @@
* @see wfWaitForSlaves()
*/
-// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( dirname( __FILE__ ) ) . '/includes/Defines.php' );
-
-if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ) ) {
- echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP " .
- MW_MIN_PHP_VERSION . " or higher. ABORTING.\n" .
- "Check if you have a newer php executable with a different name, such as php5.\n";
+if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.2.3' ) < 0 ) ) {
+ echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.2.3 or higher. ABORTING.\n" .
+ "Check if you have a newer php executable with a different name, such as php5.\n";
die( 1 );
}
diff --git a/maintenance/update.php b/maintenance/update.php
index 9f7b93c4ef..ede6ebe4aa 100644
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -25,12 +25,8 @@
* @ingroup Maintenance
*/
-// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION
-require_once( dirname( dirname( __FILE__ ) ) . '/includes/Defines.php' );
-
-if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ) ) {
- echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP " .
- MW_MIN_PHP_VERSION . "or higher. ABORTING.\n" .
+if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.2.3' ) < 0 ) ) {
+ echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.2.3 or higher. ABORTING.\n" .
"Check if you have a newer php executable with a different name, such as php5.\n";
die( 1 );
}
diff --git a/tests/parserTests.php b/tests/parserTests.php
index 761ba498e6..580f6fbb5c 100644
--- a/tests/parserTests.php
+++ b/tests/parserTests.php
@@ -30,9 +30,8 @@ $optionsWithArgs = array( 'regex', 'seed', 'setversion' );
require_once( dirname( __FILE__ ) . '/../maintenance/commandLine.inc' );
if ( isset( $options['help'] ) ) {
- $version = MW_VERSION;
echo <<