From: Aaron Schulz Date: Wed, 29 Jul 2015 20:51:42 +0000 (-0700) Subject: Use STRAIGHT_JOIN in SpecialWhatlinkshere query X-Git-Tag: 1.31.0-rc.0~10583 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=b80bcaaba3f8422637d3de4204ae75eaf5ea1bbe;p=lhc%2Fweb%2Fwiklou.git Use STRAIGHT_JOIN in SpecialWhatlinkshere query * Also added a type hint to avoid IDE errors in this area Bug: T106682 Change-Id: I825eedaceb0c0323de85466e48582d72c57b201a --- diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 5db81d4f93..a6f92d659d 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -155,7 +155,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $conds['pagelinks'][] = 'rd_from is NOT NULL'; } - $queryFunc = function ( $dbr, $table, $fromCol ) use ( + $queryFunc = function ( IDatabase $dbr, $table, $fromCol ) use ( $conds, $target, $limit, $useLinkNamespaceDBFields ) { // Read an extra row as an at-end check @@ -170,11 +170,12 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { } // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces $subQuery = $dbr->selectSqlText( - array( $table, 'page', 'redirect' ), + array( $table, 'redirect', 'page' ), array( $fromCol, 'rd_from' ), $conds[$table], __CLASS__ . '::showIndirectLinks', - array( 'ORDER BY' => $fromCol, 'LIMIT' => 2 * $queryLimit ), + // Force JOIN order per T106682 to avoid large filesorts + array( 'ORDER BY' => $fromCol, 'LIMIT' => 2 * $queryLimit, 'STRAIGHT_JOIN' ), array( 'page' => array( 'INNER JOIN', "$fromCol = page_id" ), 'redirect' => array( 'LEFT JOIN', $on )