From: Aaron Schulz Date: Thu, 8 Oct 2015 06:46:18 +0000 (-0700) Subject: Make DeferredUpdates::doUpdates use DataUpdate::runUpdates X-Git-Tag: 1.31.0-rc.0~9486^2 X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=commitdiff_plain;h=ccab8f10f67e4d733a12118c5c18e5afa7af451c;p=lhc%2Fweb%2Fwiklou.git Make DeferredUpdates::doUpdates use DataUpdate::runUpdates All DataUpdate objects will be managed by runUpdates() while the other DeferrableUpdate objects will still be run here. This respects the transaction sematics of DataUpdate a bit more. Change-Id: Ia0d2dd26a38b0e8911589407b533b58d04d2b084 --- diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index 7d02a7a9cf..8b3582db69 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -44,7 +44,7 @@ interface DeferrableUpdate { * @since 1.19 */ class DeferredUpdates { - /** @var array Updates to be deferred until the end of the request */ + /** @var DeferrableUpdate[] Updates to be deferred until the end of the request */ private static $updates = array(); /** @var bool Defer updates fully even in CLI mode */ private static $forceDeferral = false; @@ -102,9 +102,22 @@ class DeferredUpdates { while ( count( $updates ) ) { self::clearPendingUpdates(); - - /** @var DeferrableUpdate $update */ + /** @var DataUpdate[] $dataUpdates */ + $dataUpdates = array(); + /** @var DeferrableUpdate[] $otherUpdates */ + $otherUpdates = array(); foreach ( $updates as $update ) { + if ( $update instanceof DataUpdate ) { + $dataUpdates[] = $update; + } else { + $otherUpdates[] = $update; + } + } + + // Delegate DataUpdate execution to the DataUpdate class + DataUpdate::runUpdates( $dataUpdates, 'run' ); + // Execute the non-DataUpdate tasks + foreach ( $otherUpdates as $update ) { try { $update->doUpdate();