}
if ( $status->successCount == 0 ) {
- $dbw->rollback( __METHOD__ );
+ $dbw->endAtomic( __METHOD__ );
return $status;
}
// 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;
}
]
);
- // Clear caches
- $that = $this;
- $dbw->onTransactionIdle( function() use ( $that, $visibilityChangeMap ) {
- $that->doPostCommitUpdates( $visibilityChangeMap );
- } );
+ // Clear caches after commit
+ DeferredUpdates::addCallableUpdate(
+ function () use ( $visibilityChangeMap ) {
+ $this->doPostCommitUpdates( $visibilityChangeMap );
+ },
+ DeferredUpdates::PRESEND,
+ $dbw
+ );
$dbw->endAtomic( __METHOD__ );