From: Aaron Schulz Date: Tue, 29 Jul 2014 01:16:40 +0000 (-0700) Subject: Unbreak Special:WhatLinksHere for $wgUseLinkNamespaceDBFields=false X-Git-Tag: 1.31.0-rc.0~14650 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=8f2f22ab6381eb89ce0fb68075ecb2f69d75b3e7;p=lhc%2Fweb%2Fwiklou.git Unbreak Special:WhatLinksHere for $wgUseLinkNamespaceDBFields=false * Usage of the namespace selector gave a query error. This fixes b8c038f6784ef08205f7cf6d7cc11462140e3fa2. * Also handle a high amount of outdated *_namespace fields better. Change-Id: I57e51f18ae749ac64413a612d6070fab29dff51f --- diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index b92ede5995..60ac02f2a3 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -163,14 +163,17 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { if ( $wgUseLinkNamespaceDBFields ) { // migration check $on['rd_namespace'] = $target->getNamespace(); } - // Inner LIMIT is 2X in case of stale backlinks with no page + // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces $subQuery = $dbr->selectSqlText( - array( $table, 'redirect' ), + array( $table, 'page', 'redirect' ), array( $fromCol, 'rd_from' ), $conds[$table], __CLASS__ . '::showIndirectLinks', array( 'ORDER BY' => $fromCol, 'LIMIT' => 2 * $queryLimit ), - array( 'redirect' => array( 'LEFT JOIN', $on ) ) + array( + 'page' => array( 'INNER JOIN', "$fromCol = page_id" ), + 'redirect' => array( 'LEFT JOIN', $on ) + ) ); return $dbr->select( array( 'page', 'temp_backlink_range' => "($subQuery)" ),