Remove begin/commit from recordOldUpload()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 6 Oct 2015 18:10:33 +0000 (11:10 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 7 Oct 2015 02:29:11 +0000 (02:29 +0000)
* The only caller already has has transaction via lock/unlock
  and does the file operations first (avoiding contention)
* Also made recordOldUpload() protected

Change-Id: Ib03ca76895a181ed513a289e2b44f6b97e4a1bc0

includes/filerepo/file/OldLocalFile.php

index fd92e11..42ee9e4 100644 (file)
@@ -364,9 +364,8 @@ class OldLocalFile extends LocalFile {
         * @param User $user User who did this upload
         * @return bool
         */
-       function recordOldUpload( $srcPath, $archiveName, $timestamp, $comment, $user ) {
+       protected function recordOldUpload( $srcPath, $archiveName, $timestamp, $comment, $user ) {
                $dbw = $this->repo->getMasterDB();
-               $dbw->begin( __METHOD__ );
 
                $dstPath = $this->repo->getZonePath( 'public' ) . '/' . $this->getRel();
                $props = $this->repo->getFileProps( $dstPath );
@@ -394,8 +393,6 @@ class OldLocalFile extends LocalFile {
                        ), __METHOD__
                );
 
-               $dbw->commit( __METHOD__ );
-
                return true;
        }