56 if (
$type === self::PRESEND ) {
57 self::push( self::$preSendUpdates, $update );
59 self::push( self::$postSendUpdates, $update );
83 if (
$type === self::ALL ||
$type == self::PRESEND ) {
87 if (
$type === self::ALL ||
$type == self::POSTSEND ) {
96 $class = get_class( $update );
97 if ( isset( $queue[$class] ) ) {
99 $existingUpdate = $queue[$class];
100 $existingUpdate->merge( $update );
102 $queue[$class] = $update;
111 static $waitingOnTrx =
false;
112 if ( $wgCommandLineMode && !$waitingOnTrx ) {
114 $dbw = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
116 if ( $dbw && $dbw->trxLevel() ) {
117 $waitingOnTrx =
true;
118 $dbw->onTransactionIdle(
function()
use ( &$waitingOnTrx ) {
120 $waitingOnTrx =
false;
129 $stats = \MediaWiki\MediaWikiServices::getInstance()->getStatsdDataFactory();
134 while ( count( $updates ) ) {
140 foreach ( $updates
as $update ) {
142 $dataUpdates[] = $update;
144 $otherUpdates[] = $update;
148 ? get_class( $update ) .
'-' . $update->
getOrigin()
149 : get_class( $update );
150 $stats->increment(
'deferred_updates.' . $method .
'.' .
$name );
156 }
catch ( Exception
$e ) {
161 foreach ( $otherUpdates
as $update ) {
165 }
catch ( Exception $e ) {
186 self::$preSendUpdates = [];
187 self::$postSendUpdates = [];
static DeferrableUpdate[] $postSendUpdates
Updates to be deferred until after request end.
static doUpdates($mode= 'run', $type=self::ALL)
Do any deferred updates and clear the list.
static clearPendingUpdates()
Clear all pending updates without performing them.
the array() calling protocol came about after MediaWiki 1.4rc1.
static execute(array &$queue, $mode)
Interface that deferrable updates should implement.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
Interface that deferrable updates can implement.
when a variable name is used in a it is silently declared as a new local masking the global
Deferrable Update for closure/callback.
static addCallableUpdate($callable, $type=self::POSTSEND)
Add a callable update.
static runUpdates(array $updates, $mode= 'run')
Convenience method, calls doUpdate() on every DataUpdate in the array.
global $wgCommandLineMode
wfGetLB($wiki=false)
Get a load balancer object.
static getMain()
Static methods.
An error page which can definitely be safely rendered using the OutputPage.
Callback wrapper that has an originating method.
Class for managing the deferred updates.
static addUpdate(DeferrableUpdate $update, $type=self::POSTSEND)
Add an update to the deferred list.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
wfGetLBFactory()
Get the load balancer factory object.
Abstract base class for update jobs that do something with some secondary data extracted from article...
static push(array &$queue, DeferrableUpdate $update)
static logException($e)
Log an exception to the exception log (if enabled).
static DeferrableUpdate[] $preSendUpdates
Updates to be deferred until before request end.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
wfGetCaller($level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
Allows to change the fields on the form that will be generated $name