24 require_once __DIR__ .
'/Maintenance.php';
35 parent::__construct();
37 $this->
addOption(
'maxjobs',
'Maximum number of jobs to run',
false,
true );
38 $this->
addOption(
'maxtime',
'Maximum amount of wall-clock time',
false,
true );
39 $this->
addOption(
'type',
'Type of job to run',
false,
true );
40 $this->
addOption(
'procs',
'Number of processes to use',
false,
true );
41 $this->
addOption(
'nothrottle',
'Ignore job throttling configuration',
false,
false );
42 $this->
addOption(
'result',
'Set to JSON to print only a JSON response',
false,
true );
43 $this->
addOption(
'wait',
'Wait for new jobs instead of exiting',
false,
false );
47 if ( $this->
hasOption(
'memory-limit' ) ) {
48 return parent::memoryLimit();
57 $procs = intval( $this->
getOption(
'procs' ) );
58 if ( $procs < 1 || $procs > 1000 ) {
59 $this->
error(
"Invalid argument to --procs",
true );
60 } elseif ( $procs != 1 ) {
62 if ( $fc->start() !=
'child' ) {
68 $outputJSON = ( $this->
getOption(
'result' ) ===
'json' );
71 $runner =
new JobRunner( LoggerFactory::getInstance(
'runJobs' ) );
73 $runner->setDebugHandler( [ $this,
'debugInternal' ] );
77 $maxJobs = $this->
getOption(
'maxjobs',
false );
78 $maxTime = $this->
getOption(
'maxtime',
false );
79 $throttle = !$this->
hasOption(
'nothrottle' );
84 'maxJobs' => $maxJobs,
85 'maxTime' => $maxTime,
86 'throttle' => $throttle,
102 if ( $maxJobs !==
false ) {
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
hasOption($name)
Checks to see if a particular param exists.
require_once RUN_MAINTENANCE_IF_MAIN
this hook is for auditing only $response
addOption($name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Class for managing forking command line scripts.
Maintenance script that runs pending jobs.
addDescription($text)
Set the description text.
getOption($name, $default=null)
Get an option, or return the default.
output($out, $channel=null)
Throw some output to the user.
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
Job queue runner utility methods.
error($err, $die=0)
Throw an error to the user.
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method.MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances.The"Spi"in MediaWiki\Logger\Spi stands for"service provider interface".An SPI is an API intended to be implemented or extended by a third party.This software design pattern is intended to enable framework extension and replaceable components.It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki.The service provider interface allows the backend logging library to be implemented in multiple ways.The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime.This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance.Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
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