From 49a4b3f3eca6a1d702fa36d6f96634453001bc71 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 30 Aug 2010 19:07:09 +0000 Subject: [PATCH] Tweak SpecialRecentChangesQuery hook. Need to be able to modify selected fields on RCL (part 1 for bug 23916) --- docs/hooks.txt | 1 + includes/specials/SpecialRecentchanges.php | 5 +++-- includes/specials/SpecialRecentchangeslinked.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index f1bf5125b0..90b9089d4f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1564,6 +1564,7 @@ SpecialRecentChanges and SpecialRecentChangesLinked &$join_conds: join conditions for the tables $opts: FormOptions for this request &$query_options: array of options for the database request +&$select: String '*' or array of columns to select 'SpecialSearchGomatch': called when user clicked the "Go" button and the target exists diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 9dad4a0f45..0719d0d086 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -311,6 +311,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { $dbr = wfGetDB( DB_SLAVE ); $limit = $opts['limit']; $namespace = $opts['namespace']; + $select = '*'; $invert = $opts['invert']; // JOIN on watchlist for users @@ -333,7 +334,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { ); } - if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options ) ) ) + if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) ) return false; // Don't use the new_namespace_time timestamp index if: @@ -353,7 +354,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { // We have a new_namespace_time index! UNION over new=(0,1) and sort result set! } else { // New pages - $sqlNew = $dbr->selectSQLText( $tables, '*', + $sqlNew = $dbr->selectSQLText( $tables, $select, array( 'rc_new' => 1 ) + $conds, __METHOD__, array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 5da16fe628..b929a7920b 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -114,7 +114,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { $query_options, $opts['tagfilter'] ); } - if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options ) ) ) + if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) ) return false; if( $ns == NS_CATEGORY && !$showlinkedto ) { -- 2.20.1