Index: SpecialWhatlinkshere.php =================================================================== --- SpecialWhatlinkshere.php (revision 98411) +++ SpecialWhatlinkshere.php (working copy) @@ -120,9 +120,9 @@ 'pl_title' => $target->getDBkey(), ); if( $hideredirs ) { - $plConds['page_is_redirect'] = 0; + $plConds['rd_from'] = null; } elseif( $hidelinks ) { - $plConds['page_is_redirect'] = 1; + $plConds[] = 'rd_from is NOT NULL'; } $tlConds = array( @@ -157,24 +157,34 @@ $options[] = 'STRAIGHT_JOIN'; $options['LIMIT'] = $queryLimit; - $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' ); + $fields = array( 'page_id', 'page_namespace', 'page_title', 'rd_from' ); + $joinConds = array( 'redirect' => array( 'LEFT OUTER JOIN', array( + 'rd_from = page_id', + 'rd_namespace' => $target->getNamespace(), + 'rd_title' => $target->getDBkey(), + '(rd_interwiki is NULL) or (rd_interwiki = \'\')' + ))); + if( $fetchlinks ) { $options['ORDER BY'] = 'pl_from'; - $plRes = $dbr->select( array( 'pagelinks', 'page' ), $fields, - $plConds, __METHOD__, $options ); + $plRes = $dbr->select( array( 'pagelinks', 'page', 'redirect' ), $fields, + $plConds, __METHOD__, $options, + $joinConds); } if( !$hidetrans ) { $options['ORDER BY'] = 'tl_from'; - $tlRes = $dbr->select( array( 'templatelinks', 'page' ), $fields, - $tlConds, __METHOD__, $options ); + $tlRes = $dbr->select( array( 'templatelinks', 'page', 'redirect' ), $fields, + $tlConds, __METHOD__, $options, + $joinConds); } if( !$hideimages ) { $options['ORDER BY'] = 'il_from'; - $ilRes = $dbr->select( array( 'imagelinks', 'page' ), $fields, - $ilConds, __METHOD__, $options ); + $ilRes = $dbr->select( array( 'imagelinks', 'page', 'redirect' ), $fields, + $ilConds, __METHOD__, $options, + $joinConds); } if( ( !$fetchlinks || !$dbr->numRows($plRes) ) && ( $hidetrans || !$dbr->numRows($tlRes) ) && ( $hideimages || !$dbr->numRows($ilRes) ) ) { @@ -248,7 +258,7 @@ foreach ( $rows as $row ) { $nt = Title::makeTitle( $row->page_namespace, $row->page_title ); - if ( $row->page_is_redirect && $level < 2 ) { + if ( $row->rd_from && $level < 2 ) { $out->addHTML( $this->listItem( $row, $nt, true ) ); $this->showIndirectLinks( $level + 1, $nt, $wgMaxRedirectLinksRetrieved ); $out->addHTML( Xml::closeElement( 'li' ) ); @@ -283,7 +293,7 @@ } } - if( $row->page_is_redirect ) { + if( $row->rd_from ) { $query = array( 'redirect' => 'no' ); } else { $query = array(); @@ -299,7 +309,7 @@ // Display properties (redirect or template) $propsText = ''; $props = array(); - if ( $row->page_is_redirect ) + if ( $row->rd_from ) $props[] = $msgcache['isredirect']; if ( $row->is_template ) $props[] = $msgcache['istemplate'];