MediaWiki REL1_37
DeferredUpdatesScopeStack.php
Go to the documentation of this file.
1<?php
30 private $stack;
31
32 public function __construct() {
33 $this->stack = [ DeferredUpdatesScope::newRootScope() ];
34 }
35
39 public function current() {
40 return $this->stack[count( $this->stack ) - 1];
41 }
42
50 public function descend( $activeStage, DeferrableUpdate $update ) {
51 $scope = DeferredUpdatesScope::newChildScope( $activeStage, $update, $this->current() );
52 $this->stack[count( $this->stack )] = $scope;
53
54 return $scope;
55 }
56
62 public function ascend() {
63 if ( count( $this->stack ) <= 1 ) {
64 throw new LogicException( "Cannot pop root stack scope; something is out of sync" );
65 }
66
67 return array_pop( $this->stack );
68 }
69
75 public function getRecursiveDepth() {
76 return count( $this->stack ) - 1;
77 }
78}
DeferredUpdates helper class for tracking DeferrableUpdate::doUpdate() nesting levels caused by neste...
getRecursiveDepth()
Get the depth of the scope stack below the root scope.
ascend()
Pop the innermost scope from the stack.
DeferredUpdatesScope[] $stack
Stack of root scope and any recursive scopes.
descend( $activeStage, DeferrableUpdate $update)
Make a new child scope, push it onto the stack, and return it.
DeferredUpdates helper class for managing DeferrableUpdate::doUpdate() nesting levels caused by neste...
static newChildScope( $activeStage, DeferrableUpdate $update, DeferredUpdatesScope $parentScope)
Interface that deferrable updates should implement.