88 $this->workers = $conf[
'workers'];
89 $this->maxqueue = $conf[
'maxqueue'];
90 $this->timeout = $conf[
'timeout'];
91 if ( isset( $conf[
'slots'] ) ) {
92 $this->slots = $conf[
'slots'];
100 $this->isMightWaitKey = !preg_match(
'/^nowait:/', $this->
key );
117 $class = $conf[
'class'];
159 if ( $this->isMightWaitKey ) {
160 if ( self::$acquiredMightWaitKey ) {
169 return Status::newFatal(
'poolcounter-usage-error',
170 'You may only aquire a single non-nowait lock.' );
172 } elseif ( $this->timeout !== 0 ) {
173 return Status::newFatal(
'poolcounter-usage-error',
174 'Locks starting in nowait: must have 0 timeout.' );
176 return Status::newGood();
208 return $type .
':' . ( hexdec( substr( sha1(
$key ), 0, 4 ) ) %
$slots );
$wgPoolCounterConf
Configuration for processing pool control, for use in high-traffic wikis.
acquireForMe()
I want to do this task and I need to do it myself.
release()
I have successfully finished my task.
acquireForAnyone()
I want to do this task, but if anyone else does it instead, it's also fine for me.
When you have many workers (threads/servers) giving service, and a cached item expensive to produce e...
int $workers
Maximum number of workers working on tasks with the same key simultaneously.
static factory( $type, $key)
Create a Pool counter.
__construct( $conf, $type, $key)
bool $isMightWaitKey
Whether the key is a "might wait" key.
float $timeout
Maximum time in seconds to wait for the lock.
onAcquire()
Update any lock tracking information when the lock is acquired.
int $maxqueue
If this number of workers are already working/waiting, fail instead of wait.
string $key
All workers with the same key share the lock.
int $slots
Maximum number of workers working on this task type, regardless of key.
hashKeyIntoSlots( $type, $key, $slots)
Given a key (any string) and the number of lots, returns a slot key (a prefix with a suffix integer f...
release()
I have successfully finished my task.
precheckAcquire()
Checks that the lock request is sane.
static bool $acquiredMightWaitKey
Whether this process holds a "might wait" lock key.
acquireForMe()
I want to do this task and I need to do it myself.
acquireForAnyone()
I want to do this task, but if anyone else does it instead, it's also fine for me.
onRelease()
Update any lock tracking information when the lock is released.
when a variable name is used in a it is silently declared as a new local masking the global
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' 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
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