From: Evan Prodromou Date: Sun, 30 Nov 2003 23:16:21 +0000 (+0000) Subject: Sort "what links here" results alphabetically (RFE#612675). X-Git-Tag: 1.1.0~42 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22upgrade%22%2C%22reinstall=non%22%29%20.%20%22?a=commitdiff_plain;h=ffd7f8d72470bf5f39c8f768a7e0ca2399494419;p=lhc%2Fweb%2Fwiklou.git Sort "what links here" results alphabetically (RFE#612675). --- diff --git a/includes/SpecialWhatlinkshere.php b/includes/SpecialWhatlinkshere.php index afdc76ff2f..d7bfa3d69f 100644 --- a/includes/SpecialWhatlinkshere.php +++ b/includes/SpecialWhatlinkshere.php @@ -67,7 +67,7 @@ function wfShowIndirectLinks( $level, $lid ) global $wgOut, $wgUser; $fname = "wfShowIndirectLinks"; - $sql = "SELECT DISTINCT l_from FROM links WHERE l_to={$lid} LIMIT 500"; + $sql = "SELECT DISTINCT l_from FROM links WHERE l_to={$lid} ORDER BY l_from LIMIT 500"; $res = wfQuery( $sql, DB_READ, $fname ); if ( 0 == wfNumRows( $res ) ) { @@ -92,19 +92,27 @@ function wfShowIndirectLinks( $level, $lid ) $ns = $nt->getNamespace(); $t = wfStrencode( $nt->getDBkey() ); - $link = $sk->makeKnownLink( $row->l_from, "", "redirect=no" ); - $wgOut->addHTML( "
  • {$link}" ); - + # FIXME: this should be in a join above, or cached in the links table + $sql = "SELECT cur_id,cur_is_redirect FROM cur " . "WHERE cur_namespace={$ns} AND cur_title='{$t}'"; $res2 = wfQuery( $sql, DB_READ, $fname ); $s = wfFetchObject( $res2 ); if ( 1 == $s->cur_is_redirect ) { - $wgOut->addHTML( $isredir ); - if ( $level < 2 ) { - wfShowIndirectLinks( $level + 1, $s->cur_id ); - } + $extra = "redirect=no"; + } else { + $extra = ""; + } + + $link = $sk->makeKnownLink( $row->l_from, "", $extra ); + $wgOut->addHTML( "
  • {$link}" ); + + if ( 1 == $s->cur_is_redirect ) { + $wgOut->addHTML( $isredir ); + if ( $level < 2 ) { + wfShowIndirectLinks( $level + 1, $s->cur_id ); + } } $wgOut->addHTML( "
  • \n" ); }