Merge "Avoid master queries in Title::getLinksFrom()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 18 Feb 2016 14:31:18 +0000 (14:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 18 Feb 2016 14:31:18 +0000 (14:31 +0000)
1  2 
includes/Title.php

@@@ -3434,10 -3427,10 +3434,10 @@@ class Title implements LinkTarget 
         * WARNING: do not use this function on arbitrary user-supplied titles!
         * On heavily-used templates it will max out the memory.
         *
-        * @param array $options May be FOR UPDATE
+        * @param array $options Query option to Database::select()
         * @return Title[] Array of Title the Title objects linking here
         */
 -      public function getTemplateLinksTo( $options = array() ) {
 +      public function getTemplateLinksTo( $options = [] ) {
                return $this->getLinksTo( $options, 'templatelinks', 'tl' );
        }
  
  
                # If the page doesn't exist; there can't be any link from this page
                if ( !$id ) {
 -                      return array();
 +                      return [];
                }
  
-               if ( count( $options ) > 0 ) {
-                       $db = wfGetDB( DB_MASTER );
-               } else {
-                       $db = wfGetDB( DB_SLAVE );
-               }
+               $db = wfGetDB( DB_SLAVE );
  
                $blNamespace = "{$prefix}_namespace";
                $blTitle = "{$prefix}_title";