From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- includes/deferred/DataUpdate.php | 125 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 includes/deferred/DataUpdate.php (limited to 'includes/deferred/DataUpdate.php') diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php new file mode 100644 index 00000000..ed12c601 --- /dev/null +++ b/includes/deferred/DataUpdate.php @@ -0,0 +1,125 @@ +beginTransaction(); + $open_transactions[] = $update; + } + + // do work + foreach ( $updates as $update ) { + $update->doUpdate(); + } + + // commit transactions + while ( count( $open_transactions ) > 0 ) { + $trans = array_pop( $open_transactions ); + $trans->commitTransaction(); + } + } catch ( Exception $ex ) { + $exception = $ex; + wfDebug( "Caught exception, will rethrow after rollback: " . + $ex->getMessage() . "\n" ); + } + + // rollback remaining transactions + while ( count( $open_transactions ) > 0 ) { + $trans = array_pop( $open_transactions ); + $trans->rollbackTransaction(); + } + + if ( $exception ) { + throw $exception; // rethrow after cleanup + } + } +} -- cgit v1.2.3-54-g00ecf