From e15edf08865d533f511da07964917063a18941bc Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 4 Aug 2006 20:18:43 +0000 Subject: [PATCH] Refactor GROUP BY clause, add extra columns for SQL compatibility, remove debugging code. Tested on MySQL with both $uid and !$uid. :) --- includes/SpecialRecentchangeslinked.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 2a611c4d18..59a3beb5c7 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -71,6 +71,14 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { $uid = $wgUser->getID(); + $GROUPBY = " + GROUP BY rc_cur_id,rc_namespace,rc_title, + rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor, + rc_new, rc_id, rc_this_oldid, rc_last_oldid, rc_bot, rc_patrolled, rc_type +" . ($uid ? ",wl_user" : "") . " + ORDER BY rc_timestamp DESC + LIMIT {$limit}"; + // If target is a Category, use categorylinks and invert from and to if( $nt->getNamespace() == NS_CATEGORY ) { $catkey = $dbr->addQuotes( $nt->getDBKey() ); @@ -97,11 +105,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { {$cmq} AND cl_from=rc_cur_id AND cl_to=$catkey - GROUP BY rc_cur_id,rc_namespace,rc_title, - rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor, - rc_new - ORDER BY rc_timestamp DESC - LIMIT {$limit}; +$GROUPBY "; } else { $sql = @@ -129,11 +133,8 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { AND pl_namespace=rc_namespace AND pl_title=rc_title AND pl_from=$id -GROUP BY rc_cur_id,rc_namespace,rc_title, - rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor, - rc_new -ORDER BY rc_timestamp DESC - LIMIT {$limit}"; +$GROUPBY +"; } $res = $dbr->query( $sql, $fname ); @@ -156,9 +157,6 @@ ORDER BY rc_timestamp DESC if ( 0 == $count ) { break; } $obj = $dbr->fetchObject( $res ); --$count; -# print_r ( $obj ) ; -# print "
\n" ; - $rc = RecentChange::newFromRow( $obj ); $rc->counter = $counter++; $s .= $list->recentChangesLine( $rc , !empty( $obj->wl_user) ); -- 2.20.1