MediaWiki REL1_27
DataUpdate Class Reference

Abstract base class for update jobs that do something with some secondary data extracted from article. More...

Inheritance diagram for DataUpdate:
Collaboration diagram for DataUpdate:

Public Member Functions

 __construct ()
 
 beginTransaction ()
 Begin an appropriate transaction, if any.
 
 commitTransaction ()
 Commit the transaction started via beginTransaction, if any.
 
 rollbackTransaction ()
 Abort / roll back the transaction started via beginTransaction, if any.
 
- Public Member Functions inherited from DeferrableUpdate
 doUpdate ()
 Perform the actual work.
 

Static Public Member Functions

static runUpdates (array $updates, $mode='run')
 Convenience method, calls doUpdate() on every DataUpdate in the array.
 

Static Protected Member Functions

static enqueueUpdates (array $updates)
 Enqueue jobs for every DataUpdate that support enqueueUpdate() and return the remaining DataUpdate objects (those that do not)
 

Detailed Description

Abstract base class for update jobs that do something with some secondary data extracted from article.

Note
subclasses should NOT start or commit transactions in their doUpdate() method, a transaction will automatically be wrapped around the update. If need be, subclasses can override the beginTransaction() and commitTransaction() methods.

Definition at line 32 of file DataUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

DataUpdate::__construct ( )

Definition at line 33 of file DataUpdate.php.

Member Function Documentation

◆ beginTransaction()

DataUpdate::beginTransaction ( )

Begin an appropriate transaction, if any.

This default implementation does nothing.

Reimplemented in SqlDataUpdate.

Definition at line 41 of file DataUpdate.php.

◆ commitTransaction()

DataUpdate::commitTransaction ( )

Commit the transaction started via beginTransaction, if any.

This default implementation does nothing.

Reimplemented in SqlDataUpdate.

Definition at line 49 of file DataUpdate.php.

◆ enqueueUpdates()

static DataUpdate::enqueueUpdates ( array  $updates)
staticprotected

Enqueue jobs for every DataUpdate that support enqueueUpdate() and return the remaining DataUpdate objects (those that do not)

Parameters
DataUpdate[]$updatesA list of DataUpdate instances
Returns
DataUpdate[]
Since
1.27

Definition at line 132 of file DataUpdate.php.

References as, and JobQueueGroup\singleton().

Referenced by runUpdates().

◆ rollbackTransaction()

DataUpdate::rollbackTransaction ( )

Abort / roll back the transaction started via beginTransaction, if any.

This default implementation does nothing.

Definition at line 57 of file DataUpdate.php.

◆ runUpdates()

static DataUpdate::runUpdates ( array  $updates,
  $mode = 'run' 
)
static

Convenience method, calls doUpdate() on every DataUpdate in the array.

This methods supports transactions logic by first calling beginTransaction() on all updates in the array, then calling doUpdate() on each, and, if all goes well, then calling commitTransaction() on each update. If an error occurs, rollbackTransaction() will be called on any update object that had beginTransaction() called but not yet commitTransaction().

This allows for limited transactional logic across multiple backends for storing secondary data.

Parameters
DataUpdate[]$updatesA list of DataUpdate instances
string$modeUse "enqueue" to use the job queue when possible [Default: run]
Exceptions
Exception|null

Definition at line 77 of file DataUpdate.php.

References as, enqueueUpdates(), and wfDebug().

Referenced by ApiPurge\execute(), DeferredUpdates\execute(), RefreshLinks\fixLinksFromArticle(), DeleteLinksJob\run(), and RefreshLinksJob\runForTitle().


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