From ba0fc4fa20067528effd4802e53ceeb959640825 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 12 Jan 2012 13:42:29 +0100 Subject: Update to MediaWiki 1.18.1 --- includes/AjaxDispatcher.php | 9 ++- includes/DefaultSettings.php | 6 +- includes/OutputPage.php | 70 +++++++++++++------ includes/RequestContext.php | 25 +++++++ includes/Skin.php | 21 +++++- includes/SkinTemplate.php | 24 +++++-- includes/SpecialPage.php | 9 +++ includes/Title.php | 5 +- includes/User.php | 3 +- includes/UserMailer.php | 116 ++++++++++++------------------- includes/Wiki.php | 20 +++++- includes/api/ApiQueryRevisions.php | 2 +- includes/db/Database.php | 13 ++++ includes/db/DatabaseMysql.php | 2 +- includes/db/DatabaseOracle.php | 4 +- includes/filerepo/File.php | 12 ++-- includes/installer/CliInstaller.php | 8 +++ includes/installer/Installer.php | 9 ++- includes/installer/MysqlInstaller.php | 2 +- includes/installer/OracleUpdater.php | 32 +++++++++ includes/installer/PostgresUpdater.php | 2 + includes/media/Bitmap.php | 8 +-- includes/media/GIF.php | 12 ++-- includes/media/Generic.php | 18 ++--- includes/objectcache/DBABagOStuff.php | 11 +-- includes/parser/Parser.php | 22 +++--- includes/parser/StripState.php | 7 +- includes/search/SearchUpdate.php | 2 +- includes/specials/SpecialAllmessages.php | 10 +-- includes/specials/SpecialBlockList.php | 6 +- includes/specials/SpecialLinkSearch.php | 32 +++++---- includes/specials/SpecialMovepage.php | 2 +- 32 files changed, 340 insertions(+), 184 deletions(-) (limited to 'includes') diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index 17b154d6..5bc9f067 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -68,7 +68,7 @@ class AjaxDispatcher { * request. */ function performAction() { - global $wgAjaxExportList, $wgOut; + global $wgAjaxExportList, $wgOut, $wgUser; if ( empty( $this->mode ) ) { return; @@ -84,6 +84,13 @@ class AjaxDispatcher { 'Bad Request', "unknown function " . (string) $this->func_name ); + } elseif ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) + && !$wgUser->isAllowed( 'read' ) ) + { + wfHttpError( + 403, + 'Forbidden', + 'You must log in to view pages.' ); } else { wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" ); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4248add7..9d387fb5 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -33,7 +33,7 @@ $wgConf = new SiteConfiguration; /** @endcond */ /** MediaWiki version number */ -$wgVersion = '1.18.0'; +$wgVersion = '1.18.1'; /** Name of the site. It must be changed in LocalSettings.php */ $wgSitename = 'MediaWiki'; @@ -1410,6 +1410,8 @@ $wgQueryCacheLimit = 1000; $wgWantedPagesThreshold = 1; /** Enable slow parser functions */ $wgAllowSlowParserFunctions = false; +/** Allow schema updates */ +$wgAllowSchemaUpdates = true; /** * Do DELETE/INSERT for link updates instead of incremental @@ -1511,6 +1513,8 @@ $wgParserCacheType = CACHE_ANYTHING; * given, giving a callable function which will generate a suitable cache object. * * The other parameters are dependent on the class used. + * - CACHE_DBA uses $wgTmpDirectory by default. The 'dir' parameter let you + * overrides that. */ $wgObjectCaches = array( CACHE_NONE => array( 'class' => 'EmptyBagOStuff' ), diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 419bbdf7..a3a9592d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1223,6 +1223,7 @@ class OutputPage extends ContextSource { public function parserOptions( $options = null ) { if ( !$this->mParserOptions ) { $this->mParserOptions = new ParserOptions; + $this->mParserOptions->setEditSection( false ); } return wfSetVar( $this->mParserOptions, $options ); } @@ -1799,27 +1800,34 @@ class OutputPage extends ContextSource { if ( $this->mRedirect != '' ) { # Standards require redirect URLs to be absolute $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT ); - if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) { - if( !$wgDebugRedirects ) { - $message = HttpStatus::getMessage( $this->mRedirectCode ); - $response->header( "HTTP/1.1 {$this->mRedirectCode} $message" ); + + $redirect = $this->mRedirect; + $code = $this->mRedirectCode; + + if( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) { + if( $code == '301' || $code == '303' ) { + if( !$wgDebugRedirects ) { + $message = HttpStatus::getMessage( $code ); + $response->header( "HTTP/1.1 $code $message" ); + } + $this->mLastModified = wfTimestamp( TS_RFC2822 ); + } + if ( $wgVaryOnXFP ) { + $this->addVaryHeader( 'X-Forwarded-Proto' ); + } + $this->sendCacheControl(); + + $response->header( "Content-Type: text/html; charset=utf-8" ); + if( $wgDebugRedirects ) { + $url = htmlspecialchars( $redirect ); + print "\n\nRedirect\n\n\n"; + print "

Location: $url

\n"; + print "\n\n"; + } else { + $response->header( 'Location: ' . $redirect ); } - $this->mLastModified = wfTimestamp( TS_RFC2822 ); - } - if ( $wgVaryOnXFP ) { - $this->addVaryHeader( 'X-Forwarded-Proto' ); - } - $this->sendCacheControl(); - - $response->header( "Content-Type: text/html; charset=utf-8" ); - if( $wgDebugRedirects ) { - $url = htmlspecialchars( $this->mRedirect ); - print "\n\nRedirect\n\n\n"; - print "

Location: $url

\n"; - print "\n\n"; - } else { - $response->header( 'Location: ' . $this->mRedirect ); } + wfProfileOut( __METHOD__ ); return; } elseif ( $this->mStatusCode ) { @@ -1959,6 +1967,8 @@ class OutputPage extends ContextSource { * Produce the stock "please login to use the wiki" page */ public function loginToUse() { + global $wgRequest; + if( $this->getUser()->isLoggedIn() ) { throw new PermissionsError( 'read' ); } @@ -1968,12 +1978,18 @@ class OutputPage extends ContextSource { $this->setRobotPolicy( 'noindex,nofollow' ); $this->setArticleRelated( false ); + $returnto = Title::newFromURL( $wgRequest->getVal( 'title', '' ) ); + $returntoquery = array(); + if( $returnto ) { + $returntoquery = array( 'returnto' => $returnto->getPrefixedText() ); + } + $loginTitle = SpecialPage::getTitleFor( 'Userlogin' ); $loginLink = Linker::linkKnown( $loginTitle, wfMsgHtml( 'loginreqlink' ), array(), - array( 'returnto' => $this->getTitle()->getPrefixedText() ) + $returntoquery ); $this->addHTML( wfMessage( 'loginreqpagetext' )->rawParams( $loginLink )->parse() . "\n' ); @@ -2387,7 +2403,8 @@ $templates foreach ( (array) $modules as $name ) { $module = $resourceLoader->getModule( $name ); # Check that we're allowed to include this module on this page - if ( ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) + if ( !$module + || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) && $only == ResourceLoaderModule::TYPE_SCRIPTS ) || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES ) && $only == ResourceLoaderModule::TYPE_STYLES ) @@ -2603,12 +2620,15 @@ $templates /** * Get an array containing the variables to be set in mw.config in JavaScript. * + * DO NOT CALL THIS FROM OUTSIDE OF THIS CLASS OR Skin::makeGlobalVariablesScript(). + * This is only public until that function is removed. You have been warned. + * * Do not add things here which can be evaluated in ResourceLoaderStartupScript * - in other words, page-indendent/site-wide variables (without state). * You will only be adding bloat to the html page and causing page caches to * have to be purged on configuration changes. */ - protected function getJSVars() { + public function getJSVars() { global $wgUseAjax, $wgEnableMWSuggest, $wgContLang; $title = $this->getTitle(); @@ -2955,7 +2975,11 @@ $templates $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() ); $resourceLoader = $this->getResourceLoader(); foreach ( $this->getModuleStyles() as $name ) { - $group = $resourceLoader->getModule( $name )->getGroup(); + $module = $resourceLoader->getModule( $name ); + if ( !$module ) { + continue; + } + $group = $module->getGroup(); // Modules in groups named "other" or anything different than "user", "site" or "private" // will be placed in the "other" group $styles[isset( $styles[$group] ) ? $group : 'other'][] = $name; diff --git a/includes/RequestContext.php b/includes/RequestContext.php index 37617457..441a9aec 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -64,6 +64,13 @@ interface IContextSource { */ public function getLang(); + /** + * Get the Language object + * + * @return Language + */ + public function getLanguage(); + /** * Get the Skin object * @@ -233,6 +240,15 @@ class RequestContext implements IContextSource { return $this->lang; } + /** + * Get the Language object + * + * @return Language + */ + public function getLanguage() { + return $this->getLang(); + } + /** * Set the Skin object * @@ -378,6 +394,15 @@ abstract class ContextSource implements IContextSource { return $this->getContext()->getLang(); } + /** + * Get the Language object + * + * @return Language + */ + public function getLanguage() { + return $this->getContext()->getLang(); + } + /** * Get the Skin object * diff --git a/includes/Skin.php b/includes/Skin.php index a713660c..62a63ebe 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -402,6 +402,20 @@ abstract class Skin extends ContextSource { wfProfileOut( __METHOD__ ); } + /** + * Make a