- function getSQL( $offset, $limit ) {
- return "SELECT rc_namespace AS cur_namespace, rc_title AS cur_title,rc_user AS cur_user,rc_user_text AS cur_user_text,rc_comment as cur_comment," .
- "rc_timestamp AS cur_timestamp,length(cur_text) as cur_length FROM recentchanges,cur " .
- "WHERE rc_cur_id=cur_id AND rc_new=1 AND rc_namespace=0 AND cur_is_redirect=0 " .
- "ORDER BY rc_timestamp DESC LIMIT {$offset}, {$limit}";
+ function getSQL() {
+ global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
+ $usepatrol = ( $wgUseRCPatrol && $wgUser->isLoggedIn() &&
+ ( $wgUser->isAllowed('patrol') || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0;
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
+
+ # FIXME: text will break with compression
+ return
+ "SELECT 'Newpages' as type,
+ rc_namespace AS namespace,
+ rc_title AS title,
+ rc_cur_id AS cur_id,
+ rc_user AS user,
+ rc_user_text AS user_text,
+ rc_comment as comment,
+ rc_timestamp AS timestamp,
+ rc_timestamp AS value,
+ '{$usepatrol}' as usepatrol,
+ rc_patrolled AS patrolled,
+ rc_id AS rcid,
+ page_len as length,
+ page_latest as rev_id
+ FROM $recentchanges,$page
+ WHERE rc_cur_id=page_id AND rc_new=1
+ AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0";