'revision',
'MAX(rev_timestamp)',
[
- 'rev_timestamp <= ' . $this->dbw->timestamp( $mwTimestamp ),
+ 'rev_timestamp <= ' .
+ $this->dbw->addQuotes( $this->dbw->timestamp( $mwTimestamp ) ),
'rev_page' => $this->source->getArticleID()
],
__METHOD__
$this->timestampLimit = $lasttimestamp;
}
- $this->timeWhere = "rev_timestamp <= {$this->dbw->timestamp( $timeInsert )}";
+ $this->timeWhere = "rev_timestamp <= " .
+ $this->dbw->addQuotes( $this->dbw->timestamp( $timeInsert ) );
} catch ( TimestampException $ex ) {
// The timestamp we got is screwed up and merge cannot continue
// This should be detected by $this->isValidMerge()
if ( isset( $options['start'] ) ) {
$after = $options['dir'] === self::DIR_OLDER ? '<=' : '>=';
- $conds[] = 'rc_timestamp ' . $after . ' ' . $db->addQuotes( $options['start'] );
+ $conds[] = 'rc_timestamp ' . $after . ' ' .
+ $db->addQuotes( $db->timestamp( $options['start'] ) );
}
if ( isset( $options['end'] ) ) {
$before = $options['dir'] === self::DIR_OLDER ? '>=' : '<=';
- $conds[] = 'rc_timestamp ' . $before . ' ' . $db->addQuotes( $options['end'] );
+ $conds[] = 'rc_timestamp ' . $before . ' ' .
+ $db->addQuotes( $db->timestamp( $options['end'] ) );
}
return $conds;
$this->didbegin = false;
/* If we are not in a transaction, we need to be for savepoint trickery */
if ( !$dbw->trxLevel() ) {
- $dbw->begin( "FOR SAVEPOINT", DatabasePostgres::TRANSACTION_INTERNAL );
+ $dbw->begin( __CLASS__, DatabasePostgres::TRANSACTION_INTERNAL );
$this->didbegin = true;
}
}
public function commit() {
if ( $this->didbegin ) {
- $this->dbw->commit();
+ $this->dbw->commit( __CLASS__, DatabasePostgres::FLUSHING_INTERNAL );
$this->didbegin = false;
}
}
return false;
}
+ /**
+ * Pre-cache page existence to speed up link generation
+ *
+ * @param IDatabase $db
+ * @param ResultWrapper $res
+ */
+ public function preprocessResults( $db, $res ) {
+ if ( !$res->numRows() ) {
+ return;
+ }
+
+ $batch = new LinkBatch();
+ foreach ( $res as $row ) {
+ $batch->add( $row->namespace, $row->title );
+ }
+ $batch->execute();
+
+ $res->seek( 0 );
+ }
+
public function getQueryInfo() {
return [
'tables' => [ 'page', 'watchlist' ],