Made WikiPage::isRedirect() actually use page_is_redirect
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 1 Oct 2015 10:32:01 +0000 (03:32 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 1 Oct 2015 10:32:01 +0000 (03:32 -0700)
* Previously it would always fetch the whole content,
  which is silly since followRedirect() uses the redirect
  table to avoid loading the text. The initializeArticle()
  uses isRedirect() and then possibly followRedirect(). It
  makes no sense for the former to fetch all the text anway.
* The time fetching the text showed up on xenon flamegraphs.

Change-Id: I2dc216f36d3a0ea2285e64122b4d07bd9c8ae703

includes/page/WikiPage.php

index 708a875..d3978ea 100644 (file)
@@ -469,12 +469,11 @@ class WikiPage implements Page, IDBAccessObject {
         * @return bool
         */
        public function isRedirect() {
-               $content = $this->getContent();
-               if ( !$content ) {
-                       return false;
+               if ( !$this->mDataLoaded ) {
+                       $this->loadPageData();
                }
 
-               return $content->isRedirect();
+               return (bool)$this->mIsRedirect;
        }
 
        /**