- // Delegate DataUpdate execution to the DataUpdate class
- try {
- DataUpdate::runUpdates( $dataUpdates, $mode );
- } catch ( Exception $e ) {
- // Let the other updates occur if these had to rollback
- MWExceptionHandler::logException( $e );
- }
- // Execute the non-DataUpdate tasks
- foreach ( $otherUpdates as $update ) {
- try {
- $update->doUpdate();
- wfGetLBFactory()->commitMasterChanges( __METHOD__ );
- } catch ( Exception $e ) {
- // We don't want exceptions thrown during deferred updates to
- // be reported to the user since the output is already sent
- if ( !$e instanceof ErrorPageError ) {
- MWExceptionHandler::logException( $e );
+ // Execute all remaining tasks...
+ foreach ( $updatesByType as $updatesForType ) {
+ foreach ( $updatesForType as $update ) {
+ self::$executeContext = [
+ 'update' => $update,
+ 'stage' => $stage,
+ 'subqueue' => []
+ ];
+ /** @var DeferrableUpdate $update */
+ $guiError = self::runUpdate( $update, $lbFactory, $stage );
+ $reportableError = $reportableError ?: $guiError;
+ // Do the subqueue updates for $update until there are none
+ while ( self::$executeContext['subqueue'] ) {
+ $subUpdate = reset( self::$executeContext['subqueue'] );
+ $firstKey = key( self::$executeContext['subqueue'] );
+ unset( self::$executeContext['subqueue'][$firstKey] );
+
+ $guiError = self::runUpdate( $subUpdate, $lbFactory, $stage );
+ $reportableError = $reportableError ?: $guiError;