From: Happy-melon Date: Sat, 7 May 2011 14:53:08 +0000 (+0000) Subject: * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion... X-Git-Tag: 1.31.0-rc.0~30345 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=fd34d0354b6842acb0bb0cd990e508375f390f37;p=lhc%2Fweb%2Fwiklou.git * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion. Defines.php will have been loaded anywhere that DefaultSettings.php has been loaded. * Move the declaration of $wgFeedClasses from Defines.php to WebStart.php --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7bc56f8f4f..ec94af2105 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -33,8 +33,11 @@ if ( !defined( 'MW_COMPILED' ) ) { $wgConf = new SiteConfiguration; /** @endcond */ -/** MediaWiki version number */ -$wgVersion = '1.19alpha'; +/** + * MediaWiki version number + * @deprecated use the constant MW_VERSION instead + */ +$wgVersion = MW_VERSION; /** Name of the site. It must be changed in LocalSettings.php */ $wgSitename = 'MediaWiki'; @@ -4311,6 +4314,16 @@ $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 b4a8d7b41d..c226e5569a 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -9,9 +9,10 @@ * @file */ -/** +/**@{ * Version constants for the benefit of extensions */ +define( 'MW_VERSION', '1.19alpha' ); define( 'MW_SPECIALPAGE_VERSION', 2 ); /**@{ @@ -85,16 +86,6 @@ define( 'NS_IMAGE', NS_FILE ); 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 */ diff --git a/includes/Export.php b/includes/Export.php index 3a9180a810..ceda80b5eb 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -406,8 +406,7 @@ class XmlDumpWriter { } function generator() { - global $wgVersion; - return Xml::element( 'generator', array(), "MediaWiki $wgVersion" ); + return Xml::element( 'generator', array(), "MediaWiki " . MW_VERSION ); } function homelink() { diff --git a/includes/Feed.php b/includes/Feed.php index 183b8e6e59..8535eaa393 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -301,7 +301,6 @@ class RSSFeed extends ChannelFeed { * Ouput an RSS 2.0 header */ function outHeader() { - global $wgVersion; $this->outXmlHeader(); ?> @@ -310,7 +309,7 @@ class RSSFeed extends ChannelFeed { getUrl() ?> getDescription() ?> getLanguage() ?> - MediaWiki + MediaWiki formatTime( wfTimestampNow() ) ?> outXmlHeader(); ?> getFeedId() ?> @@ -371,7 +368,7 @@ class AtomFeed extends ChannelFeed { formatTime( wfTimestampNow() ) ?>Z getDescription() ?> - MediaWiki + MediaWiki 'generator', - 'content' => "MediaWiki $wgVersion", + 'content' => "MediaWiki " . MW_VERSION, ) ); $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}"; diff --git a/includes/Setup.php b/includes/Setup.php index 58b9002551..63bfa54607 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -23,6 +23,7 @@ $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 1ac60ff3e2..6d50b92f69 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -191,7 +191,6 @@ 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'] ) ) { @@ -202,7 +201,7 @@ abstract class DatabaseUpdater { $this->runUpdates( $this->getExtensionUpdates(), true ); } - $this->setAppliedUpdates( $wgVersion, $this->updates ); + $this->setAppliedUpdates( MW_VERSION, $this->updates ); if( isset( $what['purge'] ) ) { $this->purgeCache(); diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 443cf5ab40..7366888d13 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -270,8 +270,7 @@ class WebInstallerOutput { } public function outputTitle() { - global $wgVersion; - echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) ); + echo htmlspecialchars( wfMsg( 'config-title', MW_VERSION ) ); } public function getJQuery() { diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 1f66c88c2a..73961f4902 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, $wgVersion, + $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgProto, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength; @@ -71,7 +71,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), - 'wgVersion' => $wgVersion, + 'wgVersion' => MW_VERSION, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(), diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 0c09c26f14..671ae89d85 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -158,16 +158,16 @@ class SpecialVersion extends SpecialPage { * @return mixed */ public static function getVersion( $flags = '' ) { - global $wgVersion, $IP; + global $IP; wfProfileIn( __METHOD__ ); $info = self::getSvnInfo( $IP ); if ( !$info ) { - $version = $wgVersion; + $version = MW_VERSION; } elseif( $flags === 'nodb' ) { - $version = "$wgVersion (r{$info['checkout-rev']})"; + $version = MW_VERSION . " (r{$info['checkout-rev']})"; } else { - $version = $wgVersion . ' ' . + $version = MW_VERSION . ' ' . wfMsg( 'version-svn-revision', isset( $info['directory-rev'] ) ? $info['directory-rev'] : '', @@ -186,11 +186,13 @@ class SpecialVersion extends SpecialPage { * @return mixed */ public static function getVersionLinked() { - global $wgVersion, $IP; + global $IP; wfProfileIn( __METHOD__ ); $info = self::getSvnInfo( $IP ); + $version = MW_VERSION; + if ( isset( $info['checkout-rev'] ) ) { $linkText = wfMsg( 'version-svn-revision', @@ -199,12 +201,10 @@ class SpecialVersion extends SpecialPage { ); if ( isset( $info['viewvc-url'] ) ) { - $version = "$wgVersion [{$info['viewvc-url']} $linkText]"; + $version .= " [{$info['viewvc-url']} $linkText]"; } else { - $version = "$wgVersion $linkText"; + $version .= " $linkText"; } - } else { - $version = $wgVersion; } wfProfileOut( __METHOD__ ); @@ -680,9 +680,10 @@ 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 + $wgVersion . base64_decode($bravo) * $charlie'; + $juliet = 'echo $delta + strrev($foxtrot) - $alfa + $version . base64_decode($bravo) * $charlie'; for ( $i = 1; $i <= 4; $i++ ) { $rx .= '([^j]*)J'; $rp .= "+(\\$i)"; diff --git a/tests/parserTests.php b/tests/parserTests.php index 580f6fbb5c..761ba498e6 100644 --- a/tests/parserTests.php +++ b/tests/parserTests.php @@ -30,8 +30,9 @@ $optionsWithArgs = array( 'regex', 'seed', 'setversion' ); require_once( dirname( __FILE__ ) . '/../maintenance/commandLine.inc' ); if ( isset( $options['help'] ) ) { + $version = MW_VERSION; echo <<