MediaWiki master
MediaWiki\Deferred\DeferredUpdatesScope Class Reference

DeferredUpdates helper class for managing DeferrableUpdate::doUpdate() nesting levels caused by nested calls to DeferredUpdates::doUpdates() More...

Public Member Functions

 addUpdate (DeferrableUpdate $update, $stage)
 Enqueue a deferred update within this scope using the specified "defer until" time.
 
 clearPendingUpdates ()
 Cancel all pending updates within this scope.
 
 getActiveUpdate ()
 Get the deferred update that owns this scope (root scope has none)
 
 getPendingUpdates ( $stage)
 Get pending updates within this scope with the given "defer until" stage.
 
 pendingUpdatesCount ()
 Get the number of pending updates within this scope.
 
 processUpdates ( $stage, callable $callback)
 Iteratively, reassign unready pending updates to the parent scope (if applicable) and process the ready pending updates in stage-order with the callback, repeating the process until there is nothing left to do.
 

Static Public Member Functions

static newChildScope ( $activeStage, DeferrableUpdate $update, DeferredUpdatesScope $parentScope)
 
static newRootScope ()
 

Detailed Description

DeferredUpdates helper class for managing DeferrableUpdate::doUpdate() nesting levels caused by nested calls to DeferredUpdates::doUpdates()

See also
DeferredUpdates
DeferredUpdatesScopeStack
Access: internal
For use by DeferredUpdates and DeferredUpdatesScopeStack only
Since
1.36

Definition at line 32 of file DeferredUpdatesScope.php.

Member Function Documentation

◆ addUpdate()

MediaWiki\Deferred\DeferredUpdatesScope::addUpdate ( DeferrableUpdate $update,
$stage )

Enqueue a deferred update within this scope using the specified "defer until" time.

Parameters
DeferrableUpdate$update
int$stageOne of DeferredUpdates::STAGES

Definition at line 94 of file DeferredUpdatesScope.php.

◆ clearPendingUpdates()

MediaWiki\Deferred\DeferredUpdatesScope::clearPendingUpdates ( )

Cancel all pending updates within this scope.

Definition at line 148 of file DeferredUpdatesScope.php.

◆ getActiveUpdate()

MediaWiki\Deferred\DeferredUpdatesScope::getActiveUpdate ( )

Get the deferred update that owns this scope (root scope has none)

Returns
DeferrableUpdate|null

Definition at line 84 of file DeferredUpdatesScope.php.

◆ getPendingUpdates()

MediaWiki\Deferred\DeferredUpdatesScope::getPendingUpdates ( $stage)

Get pending updates within this scope with the given "defer until" stage.

Parameters
int$stageOne of DeferredUpdates::STAGES or DeferredUpdates::ALL
Returns
DeferrableUpdate[]

Definition at line 134 of file DeferredUpdatesScope.php.

◆ newChildScope()

static MediaWiki\Deferred\DeferredUpdatesScope::newChildScope ( $activeStage,
DeferrableUpdate $update,
DeferredUpdatesScope $parentScope )
static
Parameters
int$activeStageThe in-progress stage; one of DeferredUpdates::STAGES
DeferrableUpdate$updateThe deferred update that owns this scope
DeferredUpdatesScope$parentScopeThe parent scope of this scope
Returns
DeferredUpdatesScope Scope for the case of an in-progress deferred update

Definition at line 71 of file DeferredUpdatesScope.php.

Referenced by MediaWiki\Deferred\DeferredUpdatesScopeStack\descend().

◆ newRootScope()

static MediaWiki\Deferred\DeferredUpdatesScope::newRootScope ( )
static
Returns
DeferredUpdatesScope Scope for the case of no in-progress deferred update

Definition at line 61 of file DeferredUpdatesScope.php.

Referenced by MediaWiki\Deferred\DeferredUpdatesScopeStack\__construct().

◆ pendingUpdatesCount()

MediaWiki\Deferred\DeferredUpdatesScope::pendingUpdatesCount ( )

Get the number of pending updates within this scope.

Returns
int

Definition at line 124 of file DeferredUpdatesScope.php.

◆ processUpdates()

MediaWiki\Deferred\DeferredUpdatesScope::processUpdates ( $stage,
callable $callback )

Iteratively, reassign unready pending updates to the parent scope (if applicable) and process the ready pending updates in stage-order with the callback, repeating the process until there is nothing left to do.

Parameters
int$stageOne of DeferredUpdates::STAGES or DeferredUpdates::ALL
callable$callbackProcessing function with arguments (update, effective stage)

Definition at line 160 of file DeferredUpdatesScope.php.


The documentation for this class was generated from the following file: