/**
* Process the query
- * @todo This should build some basic processing here…
*
* @param array $conds
* @param FormOptions $opts
- * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
+ * @return bool|ResultWrapper Result or false
*/
- abstract public function doMainQuery( $conds, $opts );
+ public function doMainQuery( $conds, $opts ) {
+ $tables = array( 'recentchanges' );
+ $fields = RecentChange::selectFields();
+ $query_options = array();
+ $join_conds = array();
+
+ ChangeTags::modifyDisplayQuery(
+ $tables,
+ $fields,
+ $conds,
+ $join_conds,
+ $query_options,
+ ''
+ );
+
+ // @todo Fire a Special{$this->getName()}Query hook here
+ // @todo Uncomment and document
+ // if ( !wfRunHooks( 'ChangesListSpecialPageQuery',
+ // array( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) )
+ // ) {
+ // return false;
+ // }
+
+ $dbr = $this->getDB();
+ return $dbr->select(
+ $tables,
+ $fields,
+ $conds,
+ __METHOD__,
+ $query_options,
+ $join_conds
+ );
+ }
/**
* Return a DatabaseBase object for reading
* @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
*/
public function doMainQuery( $conds, $opts ) {
- $tables = array( 'recentchanges' );
- $join_conds = array();
- $query_options = array();
-
- $uid = $this->getUser()->getId();
$dbr = $this->getDB();
- $limit = $opts['limit'];
- $namespace = $opts['namespace'];
- $invert = $opts['invert'];
- $associated = $opts['associated'];
+ $user = $this->getUser();
+ $tables = array( 'recentchanges' );
$fields = RecentChange::selectFields();
+ $query_options = array();
+ $join_conds = array();
+
// JOIN on watchlist for users
- if ( $uid && $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
+ if ( $user->getId() && $user->isAllowed( 'viewmywatchlist' ) ) {
$tables[] = 'watchlist';
$fields[] = 'wl_user';
$fields[] = 'wl_notificationtimestamp';
$join_conds['watchlist'] = array( 'LEFT JOIN', array(
- 'wl_user' => $uid,
+ 'wl_user' => $user->getId(),
'wl_title=rc_title',
'wl_namespace=rc_namespace'
) );
}
- if ( $this->getUser()->isAllowed( 'rollback' ) ) {
+
+ if ( $user->isAllowed( 'rollback' ) ) {
$tables[] = 'page';
$fields[] = 'page_latest';
$join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
}
- // Tag stuff.
+
ChangeTags::modifyDisplayQuery(
$tables,
$fields,
$fields,
$conds + array( 'rc_new' => array( 0, 1 ) ),
__METHOD__,
- array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) + $query_options,
+ array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit'] ) + $query_options,
$join_conds
);
}
$dbr = $this->getDB();
$user = $this->getUser();
+
# Toggle watchlist content (all recent edits or just the latest)
if ( $opts['extended'] ) {
$limitWatchlist = $user->getIntOption( 'wllimit' );
$tables = array( 'recentchanges', 'watchlist' );
$fields = RecentChange::selectFields();
+ $query_options = array( 'ORDER BY' => 'rc_timestamp DESC' );
$join_conds = array(
'watchlist' => array(
'INNER JOIN',
),
),
);
- $options = array( 'ORDER BY' => 'rc_timestamp DESC' );
+
if ( $wgShowUpdatedMarker ) {
$fields[] = 'wl_notificationtimestamp';
}
if ( $limitWatchlist ) {
- $options['LIMIT'] = $limitWatchlist;
+ $query_options['LIMIT'] = $limitWatchlist;
}
$rollbacker = $user->isAllowed( 'rollback' );
}
- ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
- wfRunHooks( 'SpecialWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
+ ChangeTags::modifyDisplayQuery(
+ $tables,
+ $fields,
+ $conds,
+ $join_conds,
+ $query_options,
+ ''
+ );
- return $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
+ wfRunHooks( 'SpecialWatchlistQuery',
+ array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
+
+ return $dbr->select(
+ $tables,
+ $fields,
+ $conds,
+ __METHOD__,
+ $query_options,
+ $join_conds
+ );
}
/**