From: Alexandre Emsenhuber Date: Mon, 3 Jan 2011 18:15:44 +0000 (+0000) Subject: Just call loadPageData() if not already done to get the $mIsRedirect flag in Article... X-Git-Tag: 1.31.0-rc.0~32862 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=5cc90de1a17c70b5ecc3c79b0e69966f1e13f2b9;p=lhc%2Fweb%2Fwiklou.git Just call loadPageData() if not already done to get the $mIsRedirect flag in Article::isRedirect() instead of doing a lot of useless stuff --- 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; } /**