From: Aaron Schulz Date: Wed, 14 May 2014 16:43:02 +0000 (-0700) Subject: Use FOR UPDATE in prior LocalFile timestamp check X-Git-Tag: 1.31.0-rc.0~15719 X-Git-Url: http://git.cyclocoop.org/%27http:/code.google.com/p/ie7-js/Three?a=commitdiff_plain;h=582fd02fb9ca88a8acf0336af03e04469a424b33;p=lhc%2Fweb%2Fwiklou.git Use FOR UPDATE in prior LocalFile timestamp check * This covers the case with a snapshotted transaction outside of lock()/unlock() Change-Id: I8639c2e51cb918f452dc1576681d6224fb4fb2c0 --- diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index e8f70fca8d..a8fa8bd67b 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1249,8 +1249,9 @@ class LocalFile extends File { } if ( $timestamp === false ) { + // Use FOR UPDATE in case lock()/unlock() did not start the transaction $ltimestamp = $dbw->selectField( 'image', 'img_timestamp', - array( 'img_name' => $this->getName() ), __METHOD__ ); + array( 'img_name' => $this->getName() ), __METHOD__, array( 'FOR UPDATE' ) ); $ltime = $ltimestamp ? wfTimestamp( TS_UNIX, $ltimestamp ) : false; $ctime = time(); // Avoid a timestamp that is not newer than the last version