MediaWiki  1.27.2
DeferredUpdates Class Reference

Class for managing the deferred updates. More...

Collaboration diagram for DeferredUpdates:

Static Public Member Functions

static addCallableUpdate ($callable, $type=self::POSTSEND)
 Add a callable update. More...
 
static addUpdate (DeferrableUpdate $update, $type=self::POSTSEND)
 Add an update to the deferred list. More...
 
static clearPendingUpdates ()
 Clear all pending updates without performing them. More...
 
static doUpdates ($mode= 'run', $type=self::ALL)
 Do any deferred updates and clear the list. More...
 
static execute (array &$queue, $mode)
 

Public Attributes

const ALL = 0
 
const POSTSEND = 2
 
const PRESEND = 1
 

Static Private Member Functions

static push (array &$queue, DeferrableUpdate $update)
 

Static Private Attributes

static DeferrableUpdate[] $postSendUpdates = []
 Updates to be deferred until after request end. More...
 
static DeferrableUpdate[] $preSendUpdates = []
 Updates to be deferred until before request end. More...
 

Detailed Description

Class for managing the deferred updates.

In web request mode, deferred updates can be run at the end of the request, either before or after the HTTP response has been sent. In either case, they run after the DB commit step. If an update runs after the response is sent, it will not block clients. If sent before, it will run synchronously. If such an update works via queueing, it will be more likely to complete by the time the client makes their next request after this one.

In CLI mode, updates are only deferred until the current wiki has no DB write transaction active within this request.

When updates are deferred, they use a FIFO queue (one for pre-send and one for post-send).

Since
1.19

Definition at line 39 of file DeferredUpdates.php.

Member Function Documentation

static DeferredUpdates::clearPendingUpdates ( )
static

Clear all pending updates without performing them.

Generally, you don't want or need to call this. Unit tests need it though.

Definition at line 173 of file DeferredUpdates.php.

Referenced by UploadFromUrlTestSuite\setUp(), ParserTest\setUp(), and MediaWikiTestCase\setUp().

static DeferredUpdates::doUpdates (   $mode = 'run',
  $type = self::ALL 
)
static

Do any deferred updates and clear the list.

Parameters
string$modeUse "enqueue" to use the job queue when possible [Default: "run"]
integer$typeDeferredUpdates constant (PRESEND, POSTSEND, or ALL) (since 1.27)

Definition at line 82 of file DeferredUpdates.php.

References $type, and execute().

Referenced by JobRunner\executeJob(), MediaWiki\preOutputCommit(), push(), MediaWiki\restInPeace(), FileBackendTest\testAsyncWrites(), DeferredUpdatesTest\testDoUpdatesCLI(), DeferredUpdatesTest\testDoUpdatesWeb(), and BagOStuffTest\testReportDupes().

static DeferredUpdates::execute ( array $queue,
  $mode 
)
static
static DeferredUpdates::push ( array $queue,
DeferrableUpdate  $update 
)
staticprivate

Definition at line 92 of file DeferredUpdates.php.

References $wgCommandLineMode, doUpdates(), global, use, and wfGetLB().

Member Data Documentation

DeferrableUpdate [] DeferredUpdates::$postSendUpdates = []
staticprivate

Updates to be deferred until after request end.

Definition at line 43 of file DeferredUpdates.php.

DeferrableUpdate [] DeferredUpdates::$preSendUpdates = []
staticprivate

Updates to be deferred until before request end.

Definition at line 41 of file DeferredUpdates.php.

const DeferredUpdates::ALL = 0

Definition at line 45 of file DeferredUpdates.php.

const DeferredUpdates::POSTSEND = 2

Definition at line 47 of file DeferredUpdates.php.

Referenced by DeferredUpdatesTest\testDoUpdatesWeb().


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