(bug 28348) Don't call wfTimestamp() twice really fast in recordUpload2() and expect...
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 2 Apr 2011 16:49:47 +0000 (16:49 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 2 Apr 2011 16:49:47 +0000 (16:49 +0000)
includes/filerepo/LocalFile.php

index d495c00..9aa5659 100644 (file)
@@ -859,8 +859,9 @@ class LocalFile extends File {
        /**
         * Record a file upload in the upload log and the image table
         */
-       function recordUpload2( $oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null )
-       {
+       function recordUpload2(
+               $oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null
+       ) {
                if ( is_null( $user ) ) {
                        global $wgUser;
                        $user = $wgUser;
@@ -873,10 +874,14 @@ class LocalFile extends File {
                        $props = $this->repo->getFileProps( $this->getVirtualUrl() );
                }
 
+               if ( $timestamp === false ) {
+                       $timestamp = $dbw->timestamp();
+               }
+
                $props['description'] = $comment;
                $props['user'] = $user->getId();
                $props['user_text'] = $user->getName();
-               $props['timestamp'] = wfTimestamp( TS_MW );
+               $props['timestamp'] = wfTimestamp( TS_MW, $timestamp ); // DB -> TS_MW
                $this->setProps( $props );
 
                # Delete thumbnails
@@ -893,10 +898,6 @@ class LocalFile extends File {
 
                $reupload = false;
 
-               if ( $timestamp === false ) {
-                       $timestamp = $dbw->timestamp();
-               }
-
                # Test to see if the row exists using INSERT IGNORE
                # This avoids race conditions by locking the row until the commit, and also
                # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.