Trying to compare a string field with 0 (cast from false) raises an
error in PostgreSQL, and we're expecting it to not detect duplicates in
that situation anyway.
Change-Id: Ibff6daee6bbec00e37532e03c9ece041ba612de0
(cherry picked from commit
f09d66de2ab88e3ed39fc21b3805cea90eee5bfe)
// Note: sha1 has been in XML dumps since 2012. If you have an
// older dump, the duplicate detection here won't work.
// Note: sha1 has been in XML dumps since 2012. If you have an
// older dump, the duplicate detection here won't work.
- $prior = $dbw->selectField( 'revision', '1',
- [ 'rev_page' => $pageId,
+ if ( $importableRevision->getSha1Base36() !== false ) {
+ $prior = $dbw->selectField( 'revision', '1',
+ [ 'rev_page' => $pageId,
'rev_timestamp' => $dbw->timestamp( $importableRevision->getTimestamp() ),
'rev_sha1' => $importableRevision->getSha1Base36() ],
'rev_timestamp' => $dbw->timestamp( $importableRevision->getTimestamp() ),
'rev_sha1' => $importableRevision->getSha1Base36() ],
- __METHOD__
- );
- if ( $prior ) {
- // @todo FIXME: This could fail slightly for multiple matches :P
- $this->logger->debug( __METHOD__ . ": skipping existing revision for [[" .
- $importableRevision->getTitle()->getPrefixedText() . "]], timestamp " .
- $importableRevision->getTimestamp() . "\n" );
- return false;
+ __METHOD__
+ );
+ if ( $prior ) {
+ // @todo FIXME: This could fail slightly for multiple matches :P
+ $this->logger->debug( __METHOD__ . ": skipping existing revision for [[" .
+ $importableRevision->getTitle()->getPrefixedText() . "]], timestamp " .
+ $importableRevision->getTimestamp() . "\n" );
+ return false;
+ }