MediaWiki
master
|
Class for managing the deferred updates. More...
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... | |
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).
Definition at line 39 of file DeferredUpdates.php.
|
static |
Add a callable update.
In a lot of cases, we just need a callback/closure, defining a new DeferrableUpdate object is not necessary
callable | $callable | |
integer | $type | DeferredUpdates constant (PRESEND or POSTSEND) (since 1.27) |
Definition at line 72 of file DeferredUpdates.php.
References $type, and wfGetCaller().
Referenced by User\clearNotification(), FileBackendMultiWrite\doDirectoryOp(), WikiPage\doEditContent(), FileBackendMultiWrite\doOperationsInternal(), FileBackendMultiWrite\doQuickOperationsInternal(), SiteStatsUpdate\doUpdate(), EditPage\edit(), MovePageForm\execute(), CategoryViewer\getCountMessage(), MediaWiki\Logger\Monolog\BufferHandler\handle(), Category\initialize(), WikiPage\insertRedirect(), RecentChange\notifyEdit(), RecentChange\notifyNew(), WikiPage\onArticleEdit(), SpecialSearch\saveNamespaces(), Pingback\schedulePingback(), RevDelList\setVisibility(), DeferredUpdatesTest\testDoUpdatesCLI(), DeferredUpdatesTest\testDoUpdatesWeb(), WatchedItemStore\updateNotificationTimestamp(), and EditPage\updateWatchlist().
|
static |
Add an update to the deferred list.
DeferrableUpdate | $update | Some object that implements doUpdate() |
integer | $type | DeferredUpdates constant (PRESEND or POSTSEND) (since 1.27) |
Definition at line 55 of file DeferredUpdates.php.
References $type.
Referenced by MediaWiki\Session\SessionManager\autoCreateUser(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\continueAccountCreation(), LocalFile\delete(), LocalFile\deleteOld(), WikiPage\doCreate(), WikiPage\doDeleteUpdates(), WikiPage\doEditUpdates(), WikiPage\doModify(), RevDelFileList\doPostCommitUpdates(), WikiFilePage\doPurge(), WikiPage\doPurge(), LocalFileRestoreBatch\execute(), WikiImporter\finishImportPage(), LoginFormPreAuthManager\initUser(), Title\invalidateCache(), LinksUpdate\invalidateProperties(), MovePage\move(), LocalFile\move(), WikiPage\onArticleDelete(), WikiPage\onArticleEdit(), LocalFile\purgeCache(), File\purgeEverything(), Block\purgeExpired(), Title\purgeExpiredRestrictions(), LocalFile\purgeOldThumbnails(), Title\purgeSquid(), LocalFile\purgeThumbnails(), LocalFile\recordUpload2(), CdnCacheUpdateTest\testPurgeMergeWeb(), Title\touchLinks(), and PageArchive\undeleteRevisions().
|
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 185 of file DeferredUpdates.php.
Referenced by UploadFromUrlTestSuite\setUp(), ParserTest\setUp(), and MediaWikiTestCase\setUp().
|
static |
Do any deferred updates and clear the list.
string | $mode | Use "enqueue" to use the job queue when possible [Default: "run"] |
integer | $type | DeferredUpdates 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 |
Definition at line 128 of file DeferredUpdates.php.
References $e, $name, $queue, as, RequestContext\getMain(), DeferrableCallback\getOrigin(), MWExceptionHandler\logException(), DataUpdate\runUpdates(), and wfGetLBFactory().
|
staticprivate |
Definition at line 92 of file DeferredUpdates.php.
References $wgCommandLineMode, doUpdates(), global, use, and wfGetLB().
|
staticprivate |
Updates to be deferred until after request end.
Definition at line 43 of file DeferredUpdates.php.
|
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().
const DeferredUpdates::PRESEND = 1 |
Definition at line 46 of file DeferredUpdates.php.
Referenced by LocalFile\delete(), LocalFile\deleteOld(), RevDelFileList\doPostCommitUpdates(), WikiPage\doPurge(), Title\invalidateCache(), LocalFile\move(), MediaWiki\preOutputCommit(), LocalFile\purgeCache(), LocalFile\purgeOldThumbnails(), Title\purgeSquid(), LocalFile\purgeThumbnails(), LocalFile\recordUpload2(), RevDelList\setVisibility(), and DeferredUpdatesTest\testDoUpdatesWeb().