- global $wgRCMaxAge, $wgLogTypes, $wgLogRestrictions;
- // Some logs don't go in RC. This should check for that
- $basicRCLogs = array_diff( $wgLogTypes, array_keys( $wgLogRestrictions ) );
-
- $cutoff = time() - $wgRCMaxAge;
- list( $logging, $page ) = $dbw->tableNamesN( 'logging', 'page' );
- $dbw->insertSelect(
- 'recentchanges',
- array(
- 'user',
- "$logging LEFT JOIN $page ON (log_namespace=page_namespace AND log_title=page_title)"
- ),
- array(
- 'rc_timestamp' => 'log_timestamp',
- 'rc_user' => 'log_user',
- 'rc_user_text' => 'user_name',
- 'rc_namespace' => 'log_namespace',
- 'rc_title' => 'log_title',
- 'rc_comment' => 'log_comment',
- 'rc_minor' => 0,
- 'rc_bot' => 0,
- 'rc_patrolled' => 1,
- 'rc_new' => 0,
- 'rc_this_oldid' => 0,
- 'rc_last_oldid' => 0,
- 'rc_type' => RC_LOG,
- 'rc_source' => $dbw->addQuotes( RecentChange::SRC_LOG ),
- 'rc_cur_id' => $dbw->cascadingDeletes() ? 'page_id' : 'COALESCE(page_id, 0)',
- 'rc_log_type' => 'log_type',
- 'rc_log_action' => 'log_action',
- 'rc_logid' => 'log_id',
- 'rc_params' => 'log_params',
- 'rc_deleted' => 'log_deleted'
- ),
- array(
- 'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $cutoff ) ),
+ $res = $dbw->select(
+ [ 'user', 'logging', 'page' ],
+ [
+ 'log_timestamp',
+ 'log_user',
+ 'user_name',
+ 'log_namespace',
+ 'log_title',
+ 'log_comment',
+ 'page_id',
+ 'log_type',
+ 'log_action',
+ 'log_id',
+ 'log_params',
+ 'log_deleted'
+ ],
+ [
+ 'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ),
+ 'log_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ),