// 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 );
}
// 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.
$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';
/** 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;
<?php
/**
- * Global constants declarations. Do *NOT* include *anything* in this file which is
- * not a define() declaration; this file is included in all sorts of scopes and must
- * be parseable by PHP 4 without errors.
+ * A few constants that might be needed during LocalSettings.php.
*
* Note: these constants must all be resolvable at compile time by HipHop,
* since this file will not be executed during request startup for a compiled
* @file
*/
-/**@{
+/**
* Version constants for the benefit of extensions
*/
-define( 'MW_VERSION', '1.19alpha' );
define( 'MW_SPECIALPAGE_VERSION', 2 );
-/**
- * Minimum version of PHP required to run; entry points will die
- * if they try to run on a version older than this
- */
-define( 'MW_MIN_PHP_VERSION', '5.2.3' );
-
-define( 'MW_MIN_MYSQL_VERSION', '4.0.14' );
-define( 'MW_MIN_ORACLE_VERSION', '9.0.1' );
-
-/**@}*/
-
/**@{
* Database related constants
*/
define( 'NS_IMAGE_TALK', NS_FILE_TALK );
/**@}*/
+/**
+ * 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',
+);
+
/**@{
* Cache type
*/
}
function generator() {
- return Xml::element( 'generator', array(), "MediaWiki " . MW_VERSION );
+ global $wgVersion;
+ return Xml::element( 'generator', array(), "MediaWiki $wgVersion" );
}
function homelink() {
* Ouput an RSS 2.0 header
*/
function outHeader() {
+ global $wgVersion;
$this->outXmlHeader();
?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<link><?php print $this->getUrl() ?></link>
<description><?php print $this->getDescription() ?></description>
<language><?php print $this->getLanguage() ?></language>
- <generator>MediaWiki <?php print MW_VERSION ?></generator>
+ <generator>MediaWiki <?php print $wgVersion ?></generator>
<lastBuildDate><?php print $this->formatTime( wfTimestampNow() ) ?></lastBuildDate>
<?php
}
* Outputs a basic header for Atom 1.0 feeds.
*/
function outHeader() {
+ global $wgVersion;
+
$this->outXmlHeader();
?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">
<id><?php print $this->getFeedId() ?></id>
<link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/>
<updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated>
<subtitle><?php print $this->getDescription() ?></subtitle>
- <generator>MediaWiki <?php print MW_VERSION ?></generator>
+ <generator>MediaWiki <?php print $wgVersion ?></generator>
<?php
}
* a float
*/
function wfUseMW( $req_ver ) {
- if ( version_compare( MW_VERSION, (string)$req_ver, '<' ) ) {
- throw new MWException( "MediaWiki $req_ver required--this is only " . MW_VERSION );
+ global $wgVersion;
+
+ if ( version_compare( $wgVersion, (string)$req_ver, '<' ) ) {
+ throw new MWException( "MediaWiki $req_ver required--this is only $wgVersion" );
}
}
* @return String
*/
public static function userAgent() {
- return "MediaWiki/" . MW_VERSION;
+ global $wgVersion;
+ return "MediaWiki/$wgVersion";
}
/**
*/
public function getHeadLinks( Skin $sk, $addContentType = false ) {
global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
- $wgSitename, $wgHtml5, $wgMimeType,
+ $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
$wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
$wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf,
$wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang,
$tags[] = Html::element( 'meta', array(
'name' => 'generator',
- 'content' => "MediaWiki " . MW_VERSION,
+ 'content' => "MediaWiki $wgVersion",
) );
$p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
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 );
* @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'] ) ) {
$this->runUpdates( $this->getExtensionUpdates(), true );
}
- $this->setAppliedUpdates( MW_VERSION, $this->updates );
+ $this->setAppliedUpdates( $wgVersion, $this->updates );
if( isset( $what['purge'] ) ) {
$this->purgeCache();
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
*/
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;
}
public $supportedEngines = array( 'InnoDB', 'MyISAM' );
+ public $minimumVersion = '4.0.14';
+
public $webUserPrivs = array(
'DELETE',
'INSERT',
// 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;
'_OracleDefTS' => 'USERS',
'_OracleTempTS' => 'TEMP'
);
+
+ public $minimumVersion = '9.0.1'; // 9iR1
protected $connError = null;
// 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;
}
public function outputTitle() {
- echo htmlspecialchars( wfMsg( 'config-title', MW_VERSION ) );
+ global $wgVersion;
+ echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
}
public function getJQuery() {
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;
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
- 'wgVersion' => MW_VERSION,
+ 'wgVersion' => $wgVersion,
'wgEnableAPI' => $wgEnableAPI,
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(),
* @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'] : '',
* @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',
);
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__ );
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)";
* @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 = <<<ENDL
<p>
- MediaWiki requires PHP $reqVersion or higher. You are running PHP $phpversion.
+ MediaWiki requires PHP 5.2.3 or higher. You are running PHP $phpversion.
</p>
<p>
Please consider <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
* @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';
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' );
* @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
$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" );
}
* @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 );
}
* @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 );
}
require_once( dirname( __FILE__ ) . '/../maintenance/commandLine.inc' );
if ( isset( $options['help'] ) ) {
- $version = MW_VERSION;
echo <<<ENDS
-MediaWiki $version parser test suite
+MediaWiki $wgVersion parser test suite
Usage: php parserTests.php [options...]
Options: