Just call loadPageData() if not already done to get the $mIsRedirect flag in Article...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 3 Jan 2011 18:15:44 +0000 (18:15 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 3 Jan 2011 18:15:44 +0000 (18:15 +0000)
includes/Article.php

index 4031005..d4445ce 100644 (file)
@@ -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;
        }
 
        /**