X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FDeferredUpdates.php;h=67b5490511eecdc6277cec63423382e77a0dde36;hb=9aed0482f429ae0a06c5f4e3b16d5562449790ca;hp=8543c4b1f432214d4354de7805a16ff9b273b45d;hpb=b37772a99128afe1699a60718ebe2a6f8469aa8f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index 8543c4b1f4..67b5490511 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -79,7 +79,11 @@ class DeferredUpdates { public static function addUpdate( DeferrableUpdate $update, $stage = self::POSTSEND ) { global $wgCommandLineMode; - if ( self::$executeContext && self::$executeContext['stage'] >= $stage ) { + if ( + self::$executeContext && + self::$executeContext['stage'] >= $stage && + !( $update instanceof MergeableUpdate ) + ) { // This is a sub-DeferredUpdate; run it right after its parent update. // Also, while post-send updates are running, push any "pre-send" jobs to the // active post-send queue to make sure they get run this round (or at all). @@ -120,28 +124,25 @@ class DeferredUpdates { /** * Do any deferred updates and clear the list * + * If $stage is self::ALL then the queue of PRESEND updates will be resolved, + * followed by the queue of POSTSEND updates + * * @param string $mode Use "enqueue" to use the job queue when possible [Default: "run"] * @param int $stage DeferredUpdates constant (PRESEND, POSTSEND, or ALL) (since 1.27) */ public static function doUpdates( $mode = 'run', $stage = self::ALL ) { $stageEffective = ( $stage === self::ALL ) ? self::POSTSEND : $stage; + // For ALL mode, make sure that any PRESEND updates added along the way get run. + // Normally, these use the subqueue, but that isn't true for MergeableUpdate items. + do { + if ( $stage === self::ALL || $stage === self::PRESEND ) { + self::execute( self::$preSendUpdates, $mode, $stageEffective ); + } - if ( $stage === self::ALL || $stage === self::PRESEND ) { - self::execute( self::$preSendUpdates, $mode, $stageEffective ); - } - - if ( $stage === self::ALL || $stage == self::POSTSEND ) { - self::execute( self::$postSendUpdates, $mode, $stageEffective ); - } - } - - /** - * @param bool $value Whether to just immediately run updates in addUpdate() - * @since 1.28 - * @deprecated 1.29 Causes issues in Web-executed jobs - see T165714 and T100085. - */ - public static function setImmediateMode( $value ) { - wfDeprecated( __METHOD__, '1.29' ); + if ( $stage === self::ALL || $stage == self::POSTSEND ) { + self::execute( self::$postSendUpdates, $mode, $stageEffective ); + } + } while ( $stage === self::ALL && self::$preSendUpdates ); } /** @@ -155,6 +156,10 @@ class DeferredUpdates { /** @var MergeableUpdate $existingUpdate */ $existingUpdate = $queue[$class]; $existingUpdate->merge( $update ); + // Move the update to the end to handle things like mergeable purge + // updates that might depend on the prior updates in the queue running + unset( $queue[$class] ); + $queue[$class] = $existingUpdate; } else { $queue[$class] = $update; }