From c893cdddd6c37158c5e9f646216981e2298ab9c6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 26 Mar 2008 18:18:24 +0000 Subject: [PATCH] Drop some useless parameters to silly methods on the pretty much broken MediaWiki object. These are just globals, and will never be anything other than the globals, so just use them... Works around mysterious segfault we started having on some wikis, for no apparent reason, and simplifies ugly code. Sigh. --- includes/Wiki.php | 16 +++++++--------- index.php | 2 +- skins/MonoBook.php | 5 +++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 061d1a957a..44c935890e 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -92,32 +92,30 @@ class MediaWiki { * * @param String $title * @param String $action - * @param OutputPage $output - * @param WebRequest $request - * @param Language $lang * @return Title object to be $wgTitle */ - function checkInitialQueries( $title, $action, &$output, $request, $lang ) { - if( $request->getVal( 'printable' ) == 'yes' ){ - $output->setPrintable(); + function checkInitialQueries( $title, $action ) { + global $wgOut, $wgRequest, $wgContLang; + if( $wgRequest->getVal( 'printable' ) == 'yes' ){ + $wgOut->setPrintable(); } $ret = NULL; if ( '' == $title && 'delete' != $action ) { $ret = Title::newMainPage(); - } elseif ( $curid = $request->getInt( 'curid' ) ) { + } elseif ( $curid = $wgRequest->getInt( 'curid' ) ) { # URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); } else { $ret = Title::newFromURL( $title ); // check variant links so that interwiki links don't have to worry // about the possible different language variants - if( count( $lang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) + if( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) $lang->findVariantLink( $title, $ret ); } - if ( ( $oldid = $request->getInt( 'oldid' ) ) + if ( ( $oldid = $wgRequest->getInt( 'oldid' ) ) && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { // Allow oldid to override a changed or missing title. $rev = Revision::newFromId( $oldid ); diff --git a/index.php b/index.php index 4ff111b723..c7432e42a7 100644 --- a/index.php +++ b/index.php @@ -56,7 +56,7 @@ if ( !is_null( $maxLag ) ) { $action = $wgRequest->getVal( 'action', 'view' ); $title = $wgRequest->getVal( 'title' ); -$wgTitle = $mediaWiki->checkInitialQueries( $title, $action, $wgOut, $wgRequest, $wgContLang ); +$wgTitle = $mediaWiki->checkInitialQueries( $title, $action ); if ($wgTitle == NULL) { unset( $wgTitle ); } diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 4774e20ee1..389cb14218 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -174,6 +174,11 @@ class MonoBookTemplate extends QuickTemplate { +
msg('toolbox') ?>
-- 2.20.1