From 5cc90de1a17c70b5ecc3c79b0e69966f1e13f2b9 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 3 Jan 2011 18:15:44 +0000 Subject: [PATCH] Just call loadPageData() if not already done to get the $mIsRedirect flag in Article::isRedirect() instead of doing a lot of useless stuff --- includes/Article.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 40310052e0..d4445cefd2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -667,18 +667,14 @@ class Article { */ public function isRedirect( $text = false ) { if ( $text === false ) { - if ( $this->mDataLoaded ) { - return $this->mIsRedirect; + if ( !$this->mDataLoaded ) { + $this->loadPageData(); } - // Apparently loadPageData was never called - $this->loadContent(); - $titleObj = Title::newFromRedirectRecurse( $this->fetchContent() ); + return (bool)$this->mIsRedirect; } else { - $titleObj = Title::newFromRedirect( $text ); + return Title::newFromRedirect( $text ) !== null; } - - return $titleObj !== null; } /** -- 2.20.1