From 33f66d157b96ee10db0c18122179db8ca89627a7 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 12 Mar 2011 14:21:41 +0000 Subject: [PATCH] Skip a part of useless code when redirecting because of getOldIDFromRequest() or showing a diff page --- includes/Article.php | 55 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 5322366f93..8290f21da0 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -834,6 +834,32 @@ class Article { # Get variables from query string $oldid = $this->getOldID(); + + # getOldID may want us to redirect somewhere else + if ( $this->mRedirectUrl ) { + $wgOut->redirect( $this->mRedirectUrl ); + wfDebug( __METHOD__ . ": redirecting due to oldid\n" ); + wfProfileOut( __METHOD__ ); + + return; + } + + $wgOut->setArticleFlag( true ); + # Set page title (may be overridden by DISPLAYTITLE) + $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); + + # If we got diff in the query, we want to see a diff page instead of the article. + if ( $wgRequest->getCheck( 'diff' ) ) { + wfDebug( __METHOD__ . ": showing diff page\n" ); + $this->showDiffPage(); + wfProfileOut( __METHOD__ ); + + return; + } + + # Allow frames by default + $wgOut->allowClickjacking(); + $parserCache = ParserCache::singleton(); $parserOptions = $this->getParserOptions(); @@ -869,31 +895,6 @@ class Article { } } - # getOldID may want us to redirect somewhere else - if ( $this->mRedirectUrl ) { - $wgOut->redirect( $this->mRedirectUrl ); - wfDebug( __METHOD__ . ": redirecting due to oldid\n" ); - wfProfileOut( __METHOD__ ); - - return; - } - - $wgOut->setArticleFlag( true ); - # Set page title (may be overridden by DISPLAYTITLE) - $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); - - # If we got diff in the query, we want to see a diff page instead of the article. - if ( $wgRequest->getCheck( 'diff' ) ) { - wfDebug( __METHOD__ . ": showing diff page\n" ); - $this->showDiffPage(); - wfProfileOut( __METHOD__ ); - - return; - } - - # Allow frames by default - $wgOut->allowClickjacking(); - if ( !$wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) { $parserOptions->setEditSection( false ); } @@ -1070,9 +1071,7 @@ class Article { $this->mRevIdFetched = $de->mNewid; $de->showDiffPage( $diffOnly ); - // Needed to get the page's current revision - $this->loadPageData(); - if ( $diff == 0 || $diff == $this->mLatest ) { + if ( $diff == 0 || $diff == $this->getLatest() ) { # Run view updates for current revision only $this->viewUpdates(); } -- 2.20.1