Fixed transaction error while undeleting revdeleted files
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 26 Apr 2015 17:19:19 +0000 (10:19 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 26 Apr 2015 18:29:24 +0000 (18:29 +0000)
Bug: T97222
Change-Id: I16cdf228a517e93ac71ccda243b9e47b68ad7717

includes/filerepo/LocalRepo.php

index 926fd0b..e7e4c75 100644 (file)
@@ -90,7 +90,7 @@ class LocalRepo extends FileRepo {
                foreach ( $storageKeys as $key ) {
                        $hashPath = $this->getDeletedHashPath( $key );
                        $path = "$root/$hashPath$key";
-                       $dbw->begin( __METHOD__ );
+                       $dbw->startAtomic( __METHOD__ );
                        // Check for usage in deleted/hidden files and preemptively
                        // lock the key to avoid any future use until we are finished.
                        $deleted = $this->deletedFileHasKey( $key, 'lock' );
@@ -106,7 +106,7 @@ class LocalRepo extends FileRepo {
                                wfDebug( __METHOD__ . ": $key still in use\n" );
                                $status->successCount++;
                        }
-                       $dbw->commit( __METHOD__ );
+                       $dbw->endAtomic( __METHOD__ );
                }
 
                return $status;