MediaWiki REL1_39
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.
 
 consumeMatchingUpdates ( $stage, $class, callable $callback)
 Remove pending updates of the specified stage/class and pass them to a callback.
 
 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 30 of file DeferredUpdatesScope.php.

Member Function Documentation

◆ addUpdate()

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 92 of file DeferredUpdatesScope.php.

References $queue.

◆ clearPendingUpdates()

DeferredUpdatesScope::clearPendingUpdates ( )

Cancel all pending updates within this scope.

Definition at line 146 of file DeferredUpdatesScope.php.

◆ consumeMatchingUpdates()

DeferredUpdatesScope::consumeMatchingUpdates ( $stage,
$class,
callable $callback )

Remove pending updates of the specified stage/class and pass them to a callback.

Parameters
int$stageOne of DeferredUpdates::STAGES or DeferredUpdates::ALL
string$classOnly take updates of this fully qualified class/interface name
callable$callbackCallback that takes DeferrableUpdate

Definition at line 157 of file DeferredUpdatesScope.php.

References $queue.

◆ getActiveUpdate()

DeferredUpdatesScope::getActiveUpdate ( )

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

Returns
DeferrableUpdate|null

Definition at line 82 of file DeferredUpdatesScope.php.

◆ getPendingUpdates()

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 132 of file DeferredUpdatesScope.php.

References $queue.

◆ newChildScope()

static 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 69 of file DeferredUpdatesScope.php.

Referenced by DeferredUpdatesScopeStack\descend().

◆ newRootScope()

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

Definition at line 59 of file DeferredUpdatesScope.php.

Referenced by DeferredUpdatesScopeStack\__construct().

◆ pendingUpdatesCount()

DeferredUpdatesScope::pendingUpdatesCount ( )

Get the number of pending updates within this scope.

Returns
int

Definition at line 122 of file DeferredUpdatesScope.php.

◆ processUpdates()

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 184 of file DeferredUpdatesScope.php.


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