jenkins-bot has submitted this change and it was merged. Change subject: Made LocalFile avoid duplicate (name,timestamp) pairs ......................................................................
Made LocalFile avoid duplicate (name,timestamp) pairs * Various bits of code seem to assume uniqueness already bug: 65264 Change-Id: Ib00fdbe87a79296c640cd69d74928236ce7a4aee --- M includes/filerepo/file/LocalFile.php 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 73ab04d..e8f70fc 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1249,7 +1249,17 @@ } if ( $timestamp === false ) { - $timestamp = $dbw->timestamp(); + $ltimestamp = $dbw->selectField( 'image', 'img_timestamp', + array( 'img_name' => $this->getName() ), __METHOD__ ); + $ltime = $ltimestamp ? wfTimestamp( TS_UNIX, $ltimestamp ) : false; + $ctime = time(); + // Avoid a timestamp that is not newer than the last version + if ( $ctime > $ltime ) { + $timestamp = $dbw->timestamp( $ctime ); + } else { + sleep( 1 ); // fast enough uploads will go in to the future otherwise + $timestamp = $dbw->timestamp( $ltime + 1 ); + } } $props['description'] = $comment; -- To view, visit https://gerrit.wikimedia.org/r/133178 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib00fdbe87a79296c640cd69d74928236ce7a4aee Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits