Make non-exception rollback() calls safer
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 21 Jul 2016 01:33:25 +0000 (18:33 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 21 Jul 2016 18:10:43 +0000 (18:10 +0000)
Use rollbackMasterChanges() instead so that all DBs get reverted.
Otherwise, external DB updates may get committed while related local
DB changes are rolled back.

Change-Id: I74de77f4b12dc15c0473c272d090caeeb97d6983

includes/FileDeleteForm.php
includes/revisiondelete/RevDelList.php

index 98f8283..361058b 100644 (file)
@@ -203,7 +203,7 @@ class FileDeleteForm {
                                                $dbw->endAtomic( __METHOD__ );
                                        } else {
                                                // Page deleted but file still there? rollback page delete
-                                               $dbw->rollback( __METHOD__ );
+                                               wfGetLBFactory()->rollbackMasterChanges( __METHOD__ );
                                        }
                                } else {
                                        // Done; nothing changed
index 0a86e94..bad9d77 100644 (file)
@@ -244,8 +244,8 @@ abstract class RevDelList extends RevisionListBase {
                // Move files, if there are any
                $status->merge( $this->doPreCommitUpdates() );
                if ( !$status->isOK() ) {
-                       // Fatal error, such as no configured archive directory
-                       $dbw->rollback( __METHOD__ );
+                       // Fatal error, such as no configured archive directory or I/O failures
+                       wfGetLBFactory()->rollbackMasterChanges( __METHOD__ );
                        return $status;
                }