Go to the documentation of this file.
94 throw new MWException(
"No configuration for section '$section'." );
96 $this->maxPartitionsTry = isset(
$params[
'maxPartitionsTry'] )
101 arsort( $this->partitionMap, SORT_NUMERIC );
104 if ( isset(
$params[
'partitionsNoPush'] ) ) {
105 foreach (
$params[
'partitionsNoPush']
as $partition ) {
106 unset( $partitionPushMap[$partition] );
111 foreach (
array(
'class',
'sectionsByWiki',
'maxPartitionsTry',
112 'partitionsBySection',
'configByPartition',
'partitionsNoPush' )
as $o
114 unset( $baseConfig[$o] );
117 foreach ( $this->partitionMap
as $partition => $w ) {
118 if ( !isset(
$params[
'configByPartition'][$partition] ) ) {
119 throw new MWException(
"No configuration for partition '$partition'." );
122 $baseConfig +
$params[
'configByPartition'][$partition] );
125 $this->partitionPushRing =
new HashRing( $partitionPushMap );
132 return array(
'undefined',
'random',
'timestamp' );
146 $isEmpty = $this->
cache->get( $key );
147 if ( $isEmpty ===
'true' ) {
149 } elseif ( $isEmpty ===
'false' ) {
155 foreach ( $this->partitionQueues
as $queue ) {
157 $empty = $empty && $queue->doIsEmpty();
165 $this->
cache->add( $key, $empty ?
'true' :
'false', self::CACHE_TTL_LONG );
199 foreach ( $this->partitionQueues
as $queue ) {
201 $count += $queue->$method();
220 for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
223 if ( count( $jobsLeft ) ) {
225 "Could not insert job(s), {$this->maxPartitionsTry} partitions tried." );
244 $uJobsByPartition =
array();
246 foreach ( $jobs
as $key =>
$job ) {
247 if (
$job->ignoreDuplicates() ) {
248 $sha1 = sha1( serialize(
$job->getDeduplicationInfo() ) );
250 unset( $jobs[$key] );
254 if (
$flags & self::QOS_ATOMIC ) {
255 $nuJobBatches =
array( $jobs );
260 $nuJobBatches = array_chunk( $jobs, 300 );
264 foreach ( $uJobsByPartition
as $partition => $jobBatch ) {
266 $queue = $this->partitionQueues[$partition];
268 $ok = $queue->doBatchPush( $jobBatch,
$flags | self::QOS_ATOMIC );
278 if ( !$partitionRing ) {
279 throw new JobQueueError(
"Could not insert job(s), no partitions available." );
281 $jobsLeft = array_merge( $jobsLeft, $jobBatch );
286 foreach ( $nuJobBatches
as $jobBatch ) {
288 $queue = $this->partitionQueues[$partition];
290 $ok = $queue->doBatchPush( $jobBatch,
$flags | self::QOS_ATOMIC );
300 if ( !$partitionRing ) {
301 throw new JobQueueError(
"Could not insert job(s), no partitions available." );
303 $jobsLeft = array_merge( $jobsLeft, $jobBatch );
310 protected function doPop() {
313 $isEmpty = $this->
cache->get( $key );
314 if ( $isEmpty ===
'true' ) {
321 while ( count( $partitionsTry ) ) {
323 if ( $partition ===
false ) {
328 $queue = $this->partitionQueues[$partition];
330 $job = $queue->pop();
337 $job->metadata[
'QueuePartition'] = $partition;
341 unset( $partitionsTry[$partition] );
352 if ( !isset(
$job->metadata[
'QueuePartition'] ) ) {
353 throw new MWException(
"The given job has no defined partition name." );
356 return $this->partitionQueues[
$job->metadata[
'QueuePartition']]->ack(
$job );
361 $partitions = $this->partitionPushRing->getLocations(
$params[
'rootJobSignature'], 2 );
363 return $this->partitionQueues[$partitions[0]]->doIsRootJobOldDuplicate(
$job );
365 if ( isset( $partitions[1] ) ) {
366 return $this->partitionQueues[$partitions[1]]->doIsRootJobOldDuplicate(
$job );
375 $partitions = $this->partitionPushRing->getLocations(
$params[
'rootJobSignature'], 2 );
377 return $this->partitionQueues[$partitions[0]]->doDeduplicateRootJob(
$job );
379 if ( isset( $partitions[1] ) ) {
380 return $this->partitionQueues[$partitions[1]]->doDeduplicateRootJob(
$job );
390 foreach ( $this->partitionQueues
as $queue ) {
405 foreach ( $this->partitionQueues
as $queue ) {
407 $queue->waitForBackups();
419 foreach ( $this->partitionQueues
as $partition => $queue ) {
420 foreach ( $queue->getPeriodicTasks()
as $task => $def ) {
421 $tasks[
"{$partition}:{$task}"] = $def;
429 static $types =
array(
442 foreach ( $this->partitionQueues
as $queue ) {
443 $queue->doFlushCaches();
448 $iterator =
new AppendIterator();
451 foreach ( $this->partitionQueues
as $queue ) {
452 $iterator->append( $queue->getAllQueuedJobs() );
459 $iterator =
new AppendIterator();
462 foreach ( $this->partitionQueues
as $queue ) {
463 $iterator->append( $queue->getAllDelayedJobs() );
470 return "JobQueueFederated:wiki:{$this->wiki}" .
471 sha1( serialize( array_keys( $this->partitionMap ) ) );
479 foreach ( $this->partitionQueues
as $queue ) {
481 $nonEmpty = $queue->doGetSiblingQueuesWithJobs( $types );
482 if ( is_array( $nonEmpty ) ) {
487 if ( count(
$result ) == count( $types ) ) {
497 return array_values(
$result );
504 foreach ( $this->partitionQueues
as $queue ) {
506 $sizes = $queue->doGetSiblingQueueSizes( $types );
507 if ( is_array( $sizes ) ) {
532 if ( $down >= count( $this->partitionQueues ) ) {
539 foreach ( $this->partitionQueues
as $queue ) {
540 $queue->setTestingPrefix( $key );
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
throwErrorIfAllPartitionsDown( $down)
Throw an error if no partitions available.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
A BagOStuff object with no objects in it.
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning maintenance scripts have been cleaned up to use a unified class Directory structure How to run a script How to write your own DIRECTORY STRUCTURE The maintenance directory of a MediaWiki installation contains several all of which have unique purposes HOW TO RUN A SCRIPT Ridiculously just call php someScript php that s in the top level maintenance directory if not default wiki
HashRing $partitionPushRing
interface is intended to be more or less compatible with the PHP memcached client.
wfSplitWikiID( $wiki)
Split a wiki ID into DB name and table prefix.
getCoalesceLocationInternal()
Do not use this function outside of JobQueue/JobQueueGroup.
doIsRootJobOldDuplicate(Job $job)
supportedOrders()
Get the allowed queue orders for configuration validation.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
setTestingPrefix( $key)
Namespace the queue with a key to isolate it for testing.
you have access to all of the normal MediaWiki so you can get a DB use the cache
getAllQueuedJobs()
Get an iterator to traverse over all available jobs in this queue.
getLocation( $item)
Get the location of an item on the ring.
Class to both describe a background job and handle jobs.
getLocationWeights()
Get the map of locations to weight (ignores 0-weight items)
wfGetMainCache()
Get the main cache object.
doGetSiblingQueuesWithJobs(array $types)
tryJobInsertions(array $jobs, HashRing &$partitionRing, $flags)
array $partitionMap
(partition name => weight) reverse sorted by weight *
getAllDelayedJobs()
Get an iterator to traverse over all delayed jobs in this queue.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
doBatchPush(array $jobs, $flags)
wfForeignMemcKey( $db, $prefix)
Get a cache key for a foreign DB.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
getCrossPartitionSum( $type, $method)
doGetSiblingQueueSizes(array $types)
array $partitionQueues
(partition name => JobQueue) reverse sorted by weight *
static factory(array $params)
Get a job queue object of the specified type.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
static pickRandom( $weights)
Given an array of non-normalised probabilities, this function will select an element and return the a...
if(count( $args)< 1) $job
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
int $maxPartitionsTry
Maximum number of partitions to try *.
Class to handle enqueueing and running of background jobs.
__construct(array $params)
@params include:
static logException(Exception $e)
Log an exception to the exception log (if enabled).
doDeduplicateRootJob(Job $job)
optimalOrder()
Get the default queue order to use if configuration does not specify one.
Convenience class for weighted consistent hash rings.
Class to handle enqueueing and running of background jobs for federated queues.
supportsDelayedJobs()
Find out if delayed jobs are supported for configuration validation.
newWithoutLocation( $location)
Get a new hash ring with a location removed from the ring.