$emit = $obj->rc_timestamp;
$sql2 = "SELECT rev_id,rev_len FROM $revision " .
"WHERE rev_page={$lastCurId} ".
- "AND rev_timestamp<'{$emit}' ORDER BY rev_timestamp DESC LIMIT 1";
+ "AND rev_timestamp<'{$emit}' ORDER BY rev_timestamp DESC";
+ $sql2 = $dbw->limitResult($sql2, 1, false);
$res2 = $dbw->query( $sql2 );
if( $row = $dbw->fetchObject( $res2 ) ) {
$lastOldId = intval($row->rev_id);
'rc_this_oldid' => 0,
'rc_last_oldid' => 0,
'rc_type' => RC_LOG,
- 'rc_cur_id' => 'COALESCE(page_id, 0)',
+ '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',