Tweak SpecialRecentChangesQuery hook. Need to be able to modify selected fields on...
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 30 Aug 2010 19:07:09 +0000 (19:07 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 30 Aug 2010 19:07:09 +0000 (19:07 +0000)
docs/hooks.txt
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialRecentchangeslinked.php

index f1bf512..90b9089 100644 (file)
@@ -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
index 9dad4a0..0719d0d 100644 (file)
@@ -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,
index 5da16fe..b929a79 100644 (file)
@@ -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 ) {