From 90926864e6bc6d12ed914883d2d94741f0e3b244 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 12 Dec 2004 01:54:38 +0000 Subject: [PATCH] Fix index usage in contribs --- includes/SpecialContributions.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 008853280a..cf4b3bc562 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -90,14 +90,14 @@ function wfSpecialContributions( $par = '' ) { $omq .= " AND old_namespace = {$namespace}"; } - # We may have to force the index, as some options will cause - # MySQL to incorrectly pick eg the namespace index. - list( $useIndex, $tailOpts ) = $dbr->makeSelectOptions( array( - 'USE INDEX' => 'usertext_timestamp', - 'LIMIT' => $querylimit ) ); - extract( $dbr->tableNames( 'old', 'cur' ) ); if ( $userCond == '' ) { + # We may have to force the index, as some options will cause + # MySQL to incorrectly pick eg the namespace index. + list( $useIndex, $tailOpts ) = $dbr->makeSelectOptions( array( + 'USE INDEX' => 'usertext_timestamp', + 'LIMIT' => $querylimit ) ); + $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit,cur_is_new,cur_user_text FROM $cur $useIndex " . "WHERE cur_user_text='" . $dbr->strencode( $nt->getText() ) . "' {$cmq} " . "ORDER BY inverse_timestamp $tailOpts"; @@ -108,6 +108,10 @@ function wfSpecialContributions( $par = '' ) { "ORDER BY inverse_timestamp $tailOpts"; $res2 = $dbr->query( $sql, $fname ); } else { + list( $useIndex, $tailOpts ) = $dbr->makeSelectOptions( array( + 'USE INDEX' => 'user_timestamp', + 'LIMIT' => $querylimit ) ); + $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit,cur_is_new,cur_user_text FROM $cur $useIndex " . "WHERE cur_user {$userCond} {$cmq} ORDER BY inverse_timestamp $tailOpts"; $res1 = $dbr->query( $sql, $fname ); -- 2.20.1