From: Aaron Schulz Date: Tue, 29 May 2012 18:08:25 +0000 (+0000) Subject: Merge "wfProfileOut() for new return added in c6396 (c4e407c)" X-Git-Tag: 1.31.0-rc.0~23471 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=90108d8c93735d7d5964f907b999c3a326e87461;hp=2c15039e4da081ac148b34c5cd48833a05d2d9bf;p=lhc%2Fweb%2Fwiklou.git Merge "wfProfileOut() for new return added in c6396 (c4e407c)" --- diff --git a/CREDITS b/CREDITS index bac73913e6..89154a3cd5 100644 --- a/CREDITS +++ b/CREDITS @@ -7,6 +7,7 @@ following names for their contribution to the product. * Alex Z. * Alexandre Emsenhuber * Andrew Garrett +* Arthur Richards * Aryeh Gregor * Antoine Musso * Brian Wolff @@ -108,6 +109,7 @@ following names for their contribution to the product. * David Baumgarten * Denny Vrandecic * Edward Z. Yang +* Elvis Stansvik * Erwin Dokter * FunPika * fomafix @@ -135,6 +137,7 @@ following names for their contribution to the product. * Manuel Menal * Marcin Cieślak * Marcus Buck +* Mark A. Pelletier * Marooned * Mathias Ertl * Matthew Britton diff --git a/INSTALL b/INSTALL index 3a2860fe1a..c4bb8be987 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Starting with MediaWiki 1.2.0, it's possible to install and configure the wiki "in-place", as long as you have the necessary prerequisites available. Required software: -* Web server with PHP 5.2.3 or higher. +* Web server with PHP 5.3.2 or higher. * A SQL server, the following types are supported ** MySQL 5.0.2 or higher ** PostgreSQL 8.3 or higher diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index c15ebffd78..6c7fa6d25f 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -5,39 +5,45 @@ setting since version 1.2.0. If you have it on, turn it '''off''' if you can. == MediaWiki 1.19 == -THIS IS NOT A RELEASE YET +MediaWiki 1.19 is a large release that contains many new features and bug +fixes. This is a summary of the major changes of interest to users. +You can consult the RELEASE-NOTES-1.19 file for the full list of changes in +this version. -This is a beta release of the MediaWiki 1.19 branch. Please test it and let us -know what you think of it. Beta releases are not recommended for use in -production. +Our thanks go to everyone who helped to improve MediaWiki by testing the beta +release and submitting bug reports. === Changes since 1.19 beta 2 === -* Special:Watchlist no longer sets links to feed when the user is anonymous -* (bug 35565) Special:Log/patrol doesn't indicate whether patrolling was - automatic +* Special:Watchlist no longer sets links to feed when the user is anonymous. +* (bug 35961) Hash comparison should always be strict. +* Fix broken email confirmation expiration caused by MWCryptRand changes. +* (bug 35671) PHP Notice: Undefined index: gettoken in includes/api/ApiMain.php + on line 598. +* (bug 36042) 'show' causes a fatal in blocks API. === Changes since 1.19 beta 1 === * (bug 35014) Including a special page no longer sets the page's title to the - included page. -* (bug 35019) Edit summaries are no longer transformed in notification e-mails. -* (bug 35152) Help message for e-mail is shown again in user preferences. + included page +* (bug 35019) Edit summaries are no longer transformed in notification e-mails +* (bug 35152) Help message for e-mail is shown again in user preferences * (bug 34887) $3 and $4 parameters are now substituted correctly in message - "movepage-moved". + "movepage-moved" * (bug 34841) Edit links are no longer displayed when display old page versions -* (bug 34889) User name should be normalized on Special:Contributions. -* (bug 35051) If heading has a trailing space after == then its name is not - preloaded into edit summary on section edit. +* (bug 34889) User name should be normalized on Special:Contributions +* (bug 35051) If heading has a trailing space after == then its name is not + preloaded into edit summary on section edit * (bug 31417) New ID mw-content-text around the actual page text, without categories, contentSub, ... The same div often also contains the class mw-content-ltr/rtl. * (bug 35303) Proxy and DNS blacklist blocking works again -* (bug 35294) jquery.byteLimit shouldn't set element specific variables outside - the "return this.each" loop. * (bug 22555) Remove or skip strip markers from tag hooks like <nowiki> in core parser functions which operate on strings, such as padleft. * (bug 18295) Don't expose strip markers when a tag appears inside a link inside a heading. +* (bug 34212) ApiBlock/ApiUnblock allow action to take place without a token + parameter present. * (bug 34907) Fixed exposure of tokens through load.php that could have facilitated - CSRF attacks + CSRF attacks. +* (bug 35317) CSRF in Special:Upload. === Configuration changes in 1.19 === * Removed SkinTemplateSetupPageCss hook; use BeforePageDisplay instead. @@ -52,7 +58,7 @@ production. * (bug 32239) Removed $wgEnableTooltipsAndAccesskeys. * Removed $wgVectorShowVariantName. * Removed $wgExtensionAliasesFiles. Use $wgExtensionMessagesFiles. -* Removed $wgResourceLoaderInlinePrivateModules, now always enabled. +* Removed $wgResourceLoaderInlinePrivateModules , now always enabled. === New features in 1.19 === * (bug 19838) Add ability to get all interwiki prefixes also if the interwiki @@ -136,8 +142,8 @@ production. 200 status code instead of 404 for nonexistent articles. * (bug 33447) Link to the broken image tracking category from Special:Wantedfiles. * (bug 27724) Add timestamp to job queue. -* (bug 30339) Implement SpecialPage for running javascript tests. Disabled by default, - due to tests potentially being harmful, not to be run on a production wiki. +* (bug 30339) Implement SpecialPage for running javascript tests. Disabled by default, due to + tests potentially being harmful, not to be run on a production wiki. Enable by setting $wgEnableJavaScriptTest to true. * Extensions can use the RequestContextCreateSkin hook to override what skin is loaded in some contexts. @@ -154,8 +160,6 @@ production. * Special:MovePage now has a dropdown menu for namespaces. * (bug 34420) Special:Version now shows git HEAD sha1 when available. * (bug 33952) Refactor mw.toolbar to allow dynamic additions at any time. -* Now possible to specify separate section title and edit summary when adding - a new section to a page via the edit API action. === Bug fixes in 1.19 === * $wgUploadNavigationUrl should be used for file redlinks if. @@ -288,10 +292,11 @@ production. * (bug 28936, bug 5280) Broken or invalid titles can't be removed from watchlist. * (bug 34600) Older skins using useHeadElement=false were broken in 1.18. * (bug 34604) [mw.config] wgActionPaths should be an object instead of a numeral - array. + array.* (bug 12262) Indents and lists are now aligned * (bug 29753) mw.util.tooltipAccessKeyPrefix should be alt-shift for Chrome on Windows -* (bug 12262) Indents and lists are now aligned +* (bug 25095) Special:Categories should also include the first relevant item + when "from" is filled. * (bug 34972) An error occurred while changing your watchlist settings for [[Special:WhatLinksHere/Example]] @@ -330,8 +335,8 @@ production. calling action=purge&forcelinkupdate. * (bug 34377) action=watch now parses messages using the correct title instead of "API". -* (bug 35036) ResourceLoaderWikiModule should auto-update when messages (created - or overwritten) in the MediaWiki namespace change. +* (bug 35036) WikiLove messages were not automatically updated in JavaScript + after having been changed on-wiki due to a bug in core === Languages updated in 1.19 === @@ -384,7 +389,6 @@ changes to languages because of Bugzilla reports. amount of user/site scripts that are lacking dependency information. In the short to medium term these user/site scripts should be fixed by adding the used modules to the dependencies in the module registry and/or wrapping them in a callback to mw.loader.using. -* MediaWiki now requires MySQL 5.0.2 or later when using a MySQL database. == Compatibility == diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 1b35ad5c0f..b5e7cce630 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -10,13 +10,21 @@ THIS IS NOT A RELEASE YET MediaWiki 1.20 is an alpha-quality branch and is not recommended for use in production. +=== PHP 5.3 now required === +Since 1.20, the lowest supported version of PHP is now 5.3.2. Please +upgrade PHP if you have not done so prior to upgrading MediaWiki. + === Configuration changes in 1.20 === +* $wgGitRepositoryViewers defines a mapping from Git remote repository to the + Gitweb instance URL used in Special:Version * `$wgUsePathInfo = true;` is no longer needed to make $wgArticlePath work on servers using like nginx, lighttpd, and apache over fastcgi. MediaWiki now always extracts path info from REQUEST_URI if it's available. === New features in 1.20 === * Added TitleIsAlwaysKnown hook which gets called when determining if a page exists. +* Added NamespaceIsMovable hook which gets called when determining if pages in a + certain namespace can be moved. * (bug 32341) Add upload by URL domain limitation. * &useskin=default will now always display the default skin. Useful for users with a preference for the non-default skin to look at something using the default skin. @@ -47,6 +55,16 @@ production. * Edit notices can now be translated. * (bug 22887) Add warning and tracking category for preprocessor errors * (bug 31704) Allow selection of associated namespace on the watchlist +* (bug 5445) Now remove autoblocks when a user is unblocked. +* Added $wgLogExceptionBacktrace, on by default, to allow logging of exception + backtraces. +* Added device detection for determining device capabilities. +* QUnit.newMwEnvironment now supports passing a custom setup and/or teardown function. + Arguments signature has changed. First arguments is now an options object of which + 'config' can be a property. Previously 'config' itself was the first and only argument. +* New getCreator and getOldestRevision methods added to WikiPage class +* (bug 4220) the XML dump format schema now have unique identity constraints + for page and revision identifiers. Patch by Elvis Stansvik. === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. @@ -92,6 +110,10 @@ production. * (bug 35572) Blocks appear to succeed even if query fails due to wrong DB structure * (bug 31757) Add a word-separator between help-messages in HTMLForm * (bug 30410) Removed deprecated $wgFilterCallback and the 'filtered' API error. +* (bug 32604) Some messages needs escaping of wikitext inside username +* (bug 36537) Rename wfArrayToCGI to wfArrayToCgi for consistency with wfCgiToArray. +* (bug 25946) The message on the top of Special:RecentChanges is now displayed + in user language instead of content language === API changes in 1.20 === * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API. @@ -104,6 +126,10 @@ production. * (bug 32498) API now allows comparing pages using pageids * (bug 30975) API import of pages with invalid characters in this wiki leads to Fatal Error * (bug 30488) API now allows listing of backlinks/embeddedin/imageusage per pageid +* (bug 34927) Output media_type for list=filearchive +* (bug 28814) add properties to output of action=parse +* (bug 33224) add variants of content language to meta=siteinfo +* (bug 36761) "Mark pages as visited" now submits previously established filter options === Languages updated in 1.20 === @@ -111,9 +137,11 @@ MediaWiki supports over 350 languages. Many localisations are updated regularly. Below only new and removed languages are listed, as well as changes to languages because of Bugzilla reports. +* Tornedalen Finnish (fit) added. +* Mizo (lus) added. +* Santali (sat) added. * (bug 34192) Namespace gender aliases for Albanian languages (sq & aln). * (bug 35541) Namespace gender aliases for Croatian (hr). -* Mizo (lus) added. * (bug 36012) Space in $separatorTransformTable should be non-breaking in Portuguese, Esperanto and Udmurt. @@ -127,7 +155,7 @@ changes to languages because of Bugzilla reports. == Compatibility == -MediaWiki 1.20 requires PHP 5.2.3. PHP 4 is no longer supported. +MediaWiki 1.20 requires PHP 5.3.2. PHP 4 is no longer supported. MySQL is the recommended DBMS. PostgreSQL or SQLite can also be used, but support for them is somewhat less mature. There is experimental support for IBM diff --git a/api.php b/api.php index 889c5f10a2..1cd549747c 100644 --- a/api.php +++ b/api.php @@ -1,9 +1,16 @@ @gmail.com + * Copyright © 2006 Yuri Astrakhan @gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,22 +30,11 @@ * @file */ -/** - * This file is the entry point for all API queries. It begins by checking - * whether the API is enabled on this wiki; if not, it informs the user that - * s/he should set $wgEnableAPI to true and exits. Otherwise, it constructs - * a new ApiMain using the parameter passed to it as an argument in the URL - * ('?action=') and with write-enabled set to the value of $wgEnableWriteAPI - * as specified in LocalSettings.php. It then invokes "execute()" on the - * ApiMain object instance, which produces output in the format sepecified - * in the URL. - */ - // So extensions (and other code) can check whether they're running in API mode define( 'MW_API', true ); // Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { require( dirname( __FILE__ ) . '/includes/PHPVersionError.php' ); wfPHPVersionError( 'api.php' ); } diff --git a/api.php5 b/api.php5 index 72ee155e6d..bb515c5c15 100644 --- a/api.php5 +++ b/api.php5 @@ -1 +1,24 @@ - + xmlns:mw="http://www.mediawiki.org/xml/export-0.1/" + targetNamespace="http://www.mediawiki.org/xml/export-0.1/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="unbounded"/> - + - + - + - + + minOccurs="0" maxOccurs="unbounded"/> - + @@ -63,12 +63,12 @@ - + - + diff --git a/docs/export-0.2.xsd b/docs/export-0.2.xsd index 8acbf543b9..55b05f8de9 100644 --- a/docs/export-0.2.xsd +++ b/docs/export-0.2.xsd @@ -2,54 +2,54 @@ + xmlns:mw="http://www.mediawiki.org/xml/export-0.2/" + targetNamespace="http://www.mediawiki.org/xml/export-0.2/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="unbounded"/> - + - + - + - + @@ -57,7 +57,7 @@ - + @@ -68,33 +68,33 @@ - + - + - + - + - + - + - + - + diff --git a/docs/export-0.3.xsd b/docs/export-0.3.xsd index 1e0b7c88f2..ea2b816e8a 100644 --- a/docs/export-0.3.xsd +++ b/docs/export-0.3.xsd @@ -2,48 +2,48 @@ + xmlns:mw="http://www.mediawiki.org/xml/export-0.3/" + targetNamespace="http://www.mediawiki.org/xml/export-0.3/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="1"/> + minOccurs="0" maxOccurs="unbounded"/> - + @@ -53,30 +53,30 @@ - + - + - + - + + minOccurs="0" maxOccurs="unbounded" /> - + @@ -84,18 +84,18 @@ - + - + - + - + @@ -103,7 +103,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -122,33 +122,33 @@ - + - + - + - + - + - + - + - + diff --git a/docs/export-0.4.xsd b/docs/export-0.4.xsd index 3e7f2eab3e..b3ea3bf860 100644 --- a/docs/export-0.4.xsd +++ b/docs/export-0.4.xsd @@ -2,52 +2,52 @@ + xmlns:mw="http://www.mediawiki.org/xml/export-0.4/" + targetNamespace="http://www.mediawiki.org/xml/export-0.4/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="1"/> + minOccurs="0" maxOccurs="unbounded"/> - + @@ -57,23 +57,23 @@ - + - + - + - + @@ -83,10 +83,10 @@ + minOccurs="0" maxOccurs="unbounded" /> - + @@ -95,33 +95,33 @@ - + - + - + - + - + - + - + @@ -144,7 +144,7 @@ - + @@ -160,7 +160,7 @@ - + @@ -168,37 +168,37 @@ - + - + - + - + - + - + - + - + @@ -212,5 +212,5 @@ - + diff --git a/docs/export-0.5.xsd b/docs/export-0.5.xsd index 469446db38..ed6c0029c3 100644 --- a/docs/export-0.5.xsd +++ b/docs/export-0.5.xsd @@ -2,54 +2,54 @@ + xmlns:mw="http://www.mediawiki.org/xml/export-0.5/" + targetNamespace="http://www.mediawiki.org/xml/export-0.5/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="1"/> + minOccurs="0" maxOccurs="unbounded"/> - + @@ -59,23 +59,23 @@ - + - + - + - + @@ -85,10 +85,10 @@ + minOccurs="0" maxOccurs="unbounded" /> - + @@ -97,33 +97,33 @@ - + - + - + - + - + - + - + @@ -146,7 +146,7 @@ - + @@ -162,7 +162,7 @@ - + @@ -171,37 +171,37 @@ - + - + - + - + - + - + - + - + @@ -215,5 +215,5 @@ - + diff --git a/docs/export-0.6.xsd b/docs/export-0.6.xsd index 55428b56fa..4668794ee3 100644 --- a/docs/export-0.6.xsd +++ b/docs/export-0.6.xsd @@ -2,57 +2,57 @@ + xmlns:mw="http://www.mediawiki.org/xml/export-0.6/" + targetNamespace="http://www.mediawiki.org/xml/export-0.6/" + elementFormDefault="qualified"> MediaWiki's page export format - + - + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + - + + minOccurs="0" maxOccurs="1"/> + minOccurs="0" maxOccurs="unbounded"/> - + @@ -62,23 +62,23 @@ - + - + - + - + @@ -88,10 +88,10 @@ + minOccurs="0" maxOccurs="unbounded" /> - + @@ -100,36 +100,36 @@ - + - + - + - + - + - + - + - + @@ -153,7 +153,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -178,37 +178,37 @@ - + - + - + - + - + - + - + - + @@ -222,5 +222,5 @@ - + diff --git a/docs/export-0.7.xsd b/docs/export-0.7.xsd new file mode 100644 index 0000000000..1871a65876 --- /dev/null +++ b/docs/export-0.7.xsd @@ -0,0 +1,239 @@ + + + + + + + MediaWiki's page export format + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hooks.txt b/docs/hooks.txt index 33db1c53b4..8d4bdea4e8 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1351,6 +1351,11 @@ using this hook. BaseTemplate::makeListItem for details on the format of individual items inside of this array +'NamespaceIsMovable': Called when determining if it is possible to pages in a namespace. +$index: Integer; the index of the namespace being checked. +$result: Boolean; whether MediaWiki currently thinks that pages in this namespace are movable. +Hooks may change this value to override the return value of MWNamespace::isMovable() + 'NewRevisionFromEditComplete': called when a revision was inserted due to an edit $article: the WikiPage edited diff --git a/img_auth.php b/img_auth.php index a51e5caa02..d7125897c5 100644 --- a/img_auth.php +++ b/img_auth.php @@ -1,5 +1,4 @@ disable() */ + /** + * Disables output. Can be set by calling $AjaxResponse->disable() + * @var bool $mDisabled + */ private $mDisabled; - /** Date for the HTTP header Last-modified */ + /** + * Date for the HTTP header Last-modified + * @var string|false $mLastModified + */ private $mLastModified; - /** HTTP response code */ + /** + * HTTP response code + * @var string $mResponseCode + */ private $mResponseCode; - /** HTTP Vary header */ + /** + * HTTP Vary header + * @var string $mVary + */ private $mVary; - /** Content of our HTTP response */ + /** + * Content of our HTTP response + * @var string $mText + */ private $mText; /** @@ -52,22 +89,41 @@ class AjaxResponse { } } + /** + * Set the number of seconds to get the response cached by a proxy + * @param $duration int + */ function setCacheDuration( $duration ) { $this->mCacheDuration = $duration; } + /** + * Set the HTTP Vary header + * @param $vary string + */ function setVary( $vary ) { $this->mVary = $vary; } + /** + * Set the HTTP response code + * @param $code string + */ function setResponseCode( $code ) { $this->mResponseCode = $code; } + /** + * Set the HTTP header Content-Type + * @param $type string + */ function setContentType( $type ) { $this->mContentType = $type; } + /** + * Disable output. + */ function disable() { $this->mDisabled = true; } @@ -207,8 +263,8 @@ class AjaxResponse { } /** - * @param $mckey - * @param $touched + * @param $mckey string + * @param $touched int * @return bool */ function loadFromMemcached( $mckey, $touched ) { @@ -235,7 +291,7 @@ class AjaxResponse { } /** - * @param $mckey + * @param $mckey string * @param $expiry int * @return bool */ diff --git a/includes/Article.php b/includes/Article.php index 393f770bf7..ded8c497f2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1,6 +1,22 @@ mPage->getID() === 0 ) { @@ -204,7 +245,7 @@ class Article extends Page { $text = ''; } } else { - $text = wfMsgExt( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' ); + $text = wfMsgExt( $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' ); } wfProfileOut( __METHOD__ ); @@ -235,11 +276,10 @@ class Article extends Page { * @return int The old id for the request */ public function getOldIDFromRequest() { - global $wgRequest; - $this->mRedirectUrl = false; - $oldid = $wgRequest->getIntOrNull( 'oldid' ); + $request = $this->getContext()->getRequest(); + $oldid = $request->getIntOrNull( 'oldid' ); if ( $oldid === null ) { return 0; @@ -262,7 +302,7 @@ class Article extends Page { } } - if ( $wgRequest->getVal( 'direction' ) == 'next' ) { + if ( $request->getVal( 'direction' ) == 'next' ) { $nextid = $this->getTitle()->getNextRevisionID( $oldid ); if ( $nextid ) { $oldid = $nextid; @@ -270,7 +310,7 @@ class Article extends Page { } else { $this->mRedirectUrl = $this->getTitle()->getFullURL( 'redirect=no' ); } - } elseif ( $wgRequest->getVal( 'direction' ) == 'prev' ) { + } elseif ( $request->getVal( 'direction' ) == 'prev' ) { $previd = $this->getTitle()->getPreviousRevisionID( $oldid ); if ( $previd ) { $oldid = $previd; @@ -404,8 +444,7 @@ class Article extends Page { * page of the given title. */ public function view() { - global $wgUser, $wgOut, $wgRequest, $wgParser; - global $wgUseFileCache, $wgUseETag, $wgDebugToolbar; + global $wgParser, $wgUseFileCache, $wgUseETag, $wgDebugToolbar; wfProfileIn( __METHOD__ ); @@ -415,17 +454,19 @@ class Article extends Page { # the first call of this method even if $oldid is used way below. $oldid = $this->getOldID(); + $user = $this->getContext()->getUser(); # Another whitelist check in case getOldID() is altering the title - $permErrors = $this->getTitle()->getUserPermissionsErrors( 'read', $wgUser ); + $permErrors = $this->getTitle()->getUserPermissionsErrors( 'read', $user ); if ( count( $permErrors ) ) { wfDebug( __METHOD__ . ": denied on secondary read check\n" ); wfProfileOut( __METHOD__ ); throw new PermissionsError( 'read', $permErrors ); } + $outputPage = $this->getContext()->getOutput(); # getOldID() may as well want us to redirect somewhere else if ( $this->mRedirectUrl ) { - $wgOut->redirect( $this->mRedirectUrl ); + $outputPage->redirect( $this->mRedirectUrl ); wfDebug( __METHOD__ . ": redirecting due to oldid\n" ); wfProfileOut( __METHOD__ ); @@ -433,7 +474,7 @@ class Article extends Page { } # If we got diff in the query, we want to see a diff page instead of the article. - if ( $wgRequest->getCheck( 'diff' ) ) { + if ( $this->getContext()->getRequest()->getCheck( 'diff' ) ) { wfDebug( __METHOD__ . ": showing diff page\n" ); $this->showDiffPage(); wfProfileOut( __METHOD__ ); @@ -442,17 +483,17 @@ class Article extends Page { } # Set page title (may be overridden by DISPLAYTITLE) - $wgOut->setPageTitle( $this->getTitle()->getPrefixedText() ); + $outputPage->setPageTitle( $this->getTitle()->getPrefixedText() ); - $wgOut->setArticleFlag( true ); + $outputPage->setArticleFlag( true ); # Allow frames by default - $wgOut->allowClickjacking(); + $outputPage->allowClickjacking(); $parserCache = ParserCache::singleton(); $parserOptions = $this->getParserOptions(); # Render printable version, use printable version cache - if ( $wgOut->isPrintable() ) { + if ( $outputPage->isPrintable() ) { $parserOptions->setIsPrintable( true ); $parserOptions->setEditSection( false ); } elseif ( !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit' ) ) { @@ -462,11 +503,11 @@ class Article extends Page { # Try client and file cache if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) { if ( $wgUseETag ) { - $wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) ); + $outputPage->setETag( $parserCache->getETag( $this, $parserOptions ) ); } # Is it client cached? - if ( $wgOut->checkLastModified( $this->mPage->getTouched() ) ) { + if ( $outputPage->checkLastModified( $this->mPage->getTouched() ) ) { wfDebug( __METHOD__ . ": done 304\n" ); wfProfileOut( __METHOD__ ); @@ -475,8 +516,8 @@ class Article extends Page { } elseif ( $wgUseFileCache && $this->tryFileCache() ) { wfDebug( __METHOD__ . ": done file cache\n" ); # tell wgOut that output is taken care of - $wgOut->disable(); - $this->mPage->doViewUpdates( $wgUser ); + $outputPage->disable(); + $this->mPage->doViewUpdates( $user ); wfProfileOut( __METHOD__ ); return; @@ -486,7 +527,7 @@ class Article extends Page { # Should the parser cache be used? $useParserCache = $this->mPage->isParserCacheUsed( $parserOptions, $oldid ); wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" ); - if ( $wgUser->getStubThreshold() ) { + if ( $user->getStubThreshold() ) { wfIncrStats( 'pcache_miss_stub' ); } @@ -524,14 +565,14 @@ class Article extends Page { } else { wfDebug( __METHOD__ . ": showing parser cache contents\n" ); } - $wgOut->addParserOutput( $this->mParserOutput ); + $outputPage->addParserOutput( $this->mParserOutput ); # Ensure that UI elements requiring revision ID have # the correct version information. - $wgOut->setRevisionId( $this->mPage->getLatest() ); + $outputPage->setRevisionId( $this->mPage->getLatest() ); # Preload timestamp to avoid a DB hit $cachedTimestamp = $this->mParserOutput->getTimestamp(); if ( $cachedTimestamp !== null ) { - $wgOut->setRevisionTimestamp( $cachedTimestamp ); + $outputPage->setRevisionTimestamp( $cachedTimestamp ); $this->mPage->setTimestamp( $cachedTimestamp ); } $outputDone = true; @@ -555,16 +596,16 @@ class Article extends Page { # Ensure that UI elements requiring revision ID have # the correct version information. - $wgOut->setRevisionId( $this->getRevIdFetched() ); + $outputPage->setRevisionId( $this->getRevIdFetched() ); # Preload timestamp to avoid a DB hit - $wgOut->setRevisionTimestamp( $this->getTimestamp() ); + $outputPage->setRevisionTimestamp( $this->getTimestamp() ); # Pages containing custom CSS or JavaScript get special treatment if ( $this->getTitle()->isCssOrJsPage() || $this->getTitle()->isCssJsSubpage() ) { wfDebug( __METHOD__ . ": showing CSS/JS source\n" ); $this->showCssOrJsPage(); $outputDone = true; - } elseif( !wfRunHooks( 'ArticleViewCustom', array( $this->mContent, $this->getTitle(), $wgOut ) ) ) { + } elseif( !wfRunHooks( 'ArticleViewCustom', array( $this->mContent, $this->getTitle(), $outputPage ) ) ) { # Allow extensions do their own custom view for certain pages $outputDone = true; } else { @@ -573,10 +614,10 @@ class Article extends Page { if ( $rt ) { wfDebug( __METHOD__ . ": showing redirect=no page\n" ); # Viewing a redirect page (e.g. with parameter redirect=no) - $wgOut->addHTML( $this->viewRedirect( $rt ) ); + $outputPage->addHTML( $this->viewRedirect( $rt ) ); # Parse just to get categories, displaytitle, etc. $this->mParserOutput = $wgParser->parse( $text, $this->getTitle(), $parserOptions ); - $wgOut->addParserOutputNoText( $this->mParserOutput ); + $outputPage->addParserOutputNoText( $this->mParserOutput ); $outputDone = true; } } @@ -591,12 +632,12 @@ class Article extends Page { if ( !$poolArticleView->execute() ) { $error = $poolArticleView->getError(); if ( $error ) { - $wgOut->clearHTML(); // for release() errors - $wgOut->enableClientCache( false ); - $wgOut->setRobotPolicy( 'noindex,nofollow' ); + $outputPage->clearHTML(); // for release() errors + $outputPage->enableClientCache( false ); + $outputPage->setRobotPolicy( 'noindex,nofollow' ); $errortext = $error->getWikiText( false, 'view-pool-error' ); - $wgOut->addWikiText( '
' . $errortext . '
' ); + $outputPage->addWikiText( '
' . $errortext . '
' ); } # Connection or timeout error wfProfileOut( __METHOD__ ); @@ -604,12 +645,12 @@ class Article extends Page { } $this->mParserOutput = $poolArticleView->getParserOutput(); - $wgOut->addParserOutput( $this->mParserOutput ); + $outputPage->addParserOutput( $this->mParserOutput ); # Don't cache a dirty ParserOutput object if ( $poolArticleView->getIsDirty() ) { - $wgOut->setSquidMaxage( 0 ); - $wgOut->addHTML( "\n" ); + $outputPage->setSquidMaxage( 0 ); + $outputPage->addHTML( "\n" ); } $outputDone = true; @@ -638,17 +679,17 @@ class Article extends Page { if ( $this->getTitle()->isMainPage() ) { $msg = wfMessage( 'pagetitle-view-mainpage' )->inContentLanguage(); if ( !$msg->isDisabled() ) { - $wgOut->setHTMLTitle( $msg->title( $this->getTitle() )->text() ); + $outputPage->setHTMLTitle( $msg->title( $this->getTitle() )->text() ); } } # Check for any __NOINDEX__ tags on the page using $pOutput $policy = $this->getRobotPolicy( 'view', $pOutput ); - $wgOut->setIndexPolicy( $policy['index'] ); - $wgOut->setFollowPolicy( $policy['follow'] ); + $outputPage->setIndexPolicy( $policy['index'] ); + $outputPage->setFollowPolicy( $policy['follow'] ); $this->showViewFooter(); - $this->mPage->doViewUpdates( $wgUser ); + $this->mPage->doViewUpdates( $user ); wfProfileOut( __METHOD__ ); } @@ -658,11 +699,10 @@ class Article extends Page { * @param $pOutput ParserOutput */ public function adjustDisplayTitle( ParserOutput $pOutput ) { - global $wgOut; # Adjust the title if it was set by displaytitle, -{T|}- or language conversion $titleText = $pOutput->getTitleText(); if ( strval( $titleText ) !== '' ) { - $wgOut->setPageTitle( $titleText ); + $this->getContext()->getOutput()->setPageTitle( $titleText ); } } @@ -671,13 +711,13 @@ class Article extends Page { * Article::view() only, other callers should use the DifferenceEngine class. */ public function showDiffPage() { - global $wgRequest, $wgUser; - - $diff = $wgRequest->getVal( 'diff' ); - $rcid = $wgRequest->getVal( 'rcid' ); - $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); - $purge = $wgRequest->getVal( 'action' ) == 'purge'; - $unhide = $wgRequest->getInt( 'unhide' ) == 1; + $request = $this->getContext()->getRequest(); + $user = $this->getContext()->getUser(); + $diff = $request->getVal( 'diff' ); + $rcid = $request->getVal( 'rcid' ); + $diffOnly = $request->getBool( 'diffonly', $user->getOption( 'diffonly' ) ); + $purge = $request->getVal( 'action' ) == 'purge'; + $unhide = $request->getInt( 'unhide' ) == 1; $oldid = $this->getOldID(); $de = new DifferenceEngine( $this->getContext(), $oldid, $diff, $rcid, $purge, $unhide ); @@ -687,7 +727,7 @@ class Article extends Page { if ( $diff == 0 || $diff == $this->mPage->getLatest() ) { # Run view updates for current revision only - $this->mPage->doViewUpdates( $wgUser ); + $this->mPage->doViewUpdates( $user ); } } @@ -699,22 +739,21 @@ class Article extends Page { * page views. */ protected function showCssOrJsPage() { - global $wgOut; - $dir = $this->getContext()->getLanguage()->getDir(); $lang = $this->getContext()->getLanguage()->getCode(); - $wgOut->wrapWikiMsg( "
\n$1\n
", + $outputPage = $this->getContext()->getOutput(); + $outputPage->wrapWikiMsg( "
\n$1\n
", 'clearyourcache' ); // Give hooks a chance to customise the output - if ( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->getTitle(), $wgOut ) ) ) { + if ( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->getTitle(), $outputPage ) ) ) { // Wrap the whole lot in a
 and don't parse
 			$m = array();
 			preg_match( '!\.(css|js)$!u', $this->getTitle()->getText(), $m );
-			$wgOut->addHTML( "
\n" );
-			$wgOut->addHTML( htmlspecialchars( $this->mContent ) );
-			$wgOut->addHTML( "\n
\n" ); + $outputPage->addHTML( "
\n" );
+			$outputPage->addHTML( htmlspecialchars( $this->mContent ) );
+			$outputPage->addHTML( "\n
\n" ); } } @@ -726,8 +765,7 @@ class Article extends Page { * TODO: actions other than 'view' */ public function getRobotPolicy( $action, $pOutput ) { - global $wgOut, $wgArticleRobotPolicies, $wgNamespaceRobotPolicies; - global $wgDefaultRobotPolicy, $wgRequest; + global $wgArticleRobotPolicies, $wgNamespaceRobotPolicies, $wgDefaultRobotPolicy; $ns = $this->getTitle()->getNamespace(); @@ -749,13 +787,13 @@ class Article extends Page { 'index' => 'noindex', 'follow' => 'nofollow' ); - } elseif ( $wgOut->isPrintable() ) { + } elseif ( $this->getContext()->getOutput()->isPrintable() ) { # Discourage indexing of printable versions, but encourage following return array( 'index' => 'noindex', 'follow' => 'follow' ); - } elseif ( $wgRequest->getInt( 'curid' ) ) { + } elseif ( $this->getContext()->getRequest()->getInt( 'curid' ) ) { # For ?curid=x urls, disallow indexing return array( 'index' => 'noindex', @@ -798,7 +836,7 @@ class Article extends Page { * merging of several policies using array_merge(). * @param $policy Mixed, returns empty array on null/false/'', transparent * to already-converted arrays, converts String. - * @return Array: 'index' => , 'follow' => + * @return Array: 'index' => \, 'follow' => \ */ public static function formatRobotPolicy( $policy ) { if ( is_array( $policy ) ) { @@ -824,15 +862,16 @@ class Article extends Page { /** * If this request is a redirect view, send "redirected from" subtitle to - * $wgOut. Returns true if the header was needed, false if this is not a - * redirect view. Handles both local and remote redirects. + * the output. Returns true if the header was needed, false if this is not + * a redirect view. Handles both local and remote redirects. * * @return boolean */ public function showRedirectedFromHeader() { - global $wgOut, $wgRequest, $wgRedirectSources; + global $wgRedirectSources; + $outputPage = $this->getContext()->getOutput(); - $rdfrom = $wgRequest->getVal( 'rdfrom' ); + $rdfrom = $this->getContext()->getRequest()->getVal( 'rdfrom' ); if ( isset( $this->mRedirectedFrom ) ) { // This is an internally redirected page view. @@ -845,21 +884,21 @@ class Article extends Page { array( 'redirect' => 'no' ) ); - $wgOut->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); + $outputPage->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); // Set the fragment if one was specified in the redirect if ( strval( $this->getTitle()->getFragment() ) != '' ) { $fragment = Xml::escapeJsString( $this->getTitle()->getFragmentForURL() ); - $wgOut->addInlineScript( "redirectToFragment(\"$fragment\");" ); + $outputPage->addInlineScript( "redirectToFragment(\"$fragment\");" ); } // Add a tag - $wgOut->addLink( array( 'rel' => 'canonical', + $outputPage->addLink( array( 'rel' => 'canonical', 'href' => $this->getTitle()->getLocalURL() ) ); - // Tell $wgOut the user arrived at this article through a redirect - $wgOut->setRedirectedFrom( $this->mRedirectedFrom ); + // Tell the output object that the user arrived at this article through a redirect + $outputPage->setRedirectedFrom( $this->mRedirectedFrom ); return true; } @@ -868,7 +907,7 @@ class Article extends Page { // If it was reported from a trusted site, supply a backlink. if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) { $redir = Linker::makeExternalLink( $rdfrom, $rdfrom ); - $wgOut->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); + $outputPage->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); return true; } @@ -882,11 +921,9 @@ class Article extends Page { * [[MediaWiki:Talkpagetext]]. For Article::view(). */ public function showNamespaceHeader() { - global $wgOut; - if ( $this->getTitle()->isTalkPage() ) { if ( !wfMessage( 'talkpageheader' )->isDisabled() ) { - $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'talkpageheader' ) ); + $this->getContext()->getOutput()->wrapWikiMsg( "
\n$1\n
", array( 'talkpageheader' ) ); } } } @@ -895,11 +932,9 @@ class Article extends Page { * Show the footer section of an ordinary page view */ public function showViewFooter() { - global $wgOut; - # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page if ( $this->getTitle()->getNamespace() == NS_USER_TALK && IP::isValid( $this->getTitle()->getText() ) ) { - $wgOut->addWikiMsg( 'anontalkpagetext' ); + $this->getContext()->getOutput()->addWikiMsg( 'anontalkpagetext' ); } # If we have been passed an &rcid= parameter, we want to give the user a @@ -916,18 +951,19 @@ class Article extends Page { * desired, does nothing. */ public function showPatrolFooter() { - global $wgOut, $wgRequest, $wgUser; - - $rcid = $wgRequest->getVal( 'rcid' ); + $request = $this->getContext()->getRequest(); + $outputPage = $this->getContext()->getOutput(); + $user = $this->getContext()->getUser(); + $rcid = $request->getVal( 'rcid' ); if ( !$rcid || !$this->getTitle()->quickUserCan( 'patrol' ) ) { return; } - $token = $wgUser->getEditToken( $rcid ); - $wgOut->preventClickjacking(); + $token = $user->getEditToken( $rcid ); + $outputPage->preventClickjacking(); - $wgOut->addHTML( + $outputPage->addHTML( "