MediaWiki REL1_40
|
Manage forking inside CLI maintenance scripts. More...
Inherited by MediaWiki\Maintenance\OrderedStreamingForkController.
Public Member Functions | |
__construct ( $numProcs, $flags=0) | |
getChildNumber () | |
Get the number of the child currently running. | |
start () | |
Start the child processes. | |
Protected Member Functions | |
forkWorkers ( $numProcs) | |
Fork a number of worker processes. | |
handleTermSignal ( $signal) | |
initChild () | |
prepareEnvironment () | |
Protected Attributes | |
int | $childNumber = 0 |
array null | $children = [] |
int | $flags = 0 |
int | $procsToStart = 0 |
bool | $termReceived = false |
Static Protected Attributes | |
static | $RESTARTABLE_SIGNALS = [] |
Manage forking inside CLI maintenance scripts.
Only handles forking and process control. In the future, this could be extended to provide IPC and job dispatch.
This class requires the posix and pcntl extensions.
Definition at line 38 of file ForkController.php.
MediaWiki\Maintenance\ForkController::__construct | ( | $numProcs, | |
$flags = 0 ) |
int | $numProcs | The number of worker processes to fork |
int | $flags |
Definition at line 66 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\$flags, and wfIsCLI().
|
protected |
Fork a number of worker processes.
int | $numProcs |
Reimplemented in MediaWiki\Maintenance\OrderedStreamingForkController.
Definition at line 189 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\initChild(), and MediaWiki\Maintenance\ForkController\prepareEnvironment().
Referenced by MediaWiki\Maintenance\ForkController\start().
MediaWiki\Maintenance\ForkController::getChildNumber | ( | ) |
Get the number of the child currently running.
Note, this is not the pid, but rather which of the total number of children we are
Definition at line 172 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\$childNumber.
|
protected |
Definition at line 219 of file ForkController.php.
|
protected |
Definition at line 214 of file ForkController.php.
Referenced by MediaWiki\Maintenance\ForkController\forkWorkers(), and MediaWiki\Maintenance\OrderedStreamingForkController\forkWorkers().
|
protected |
Definition at line 176 of file ForkController.php.
References RedisConnectionPool\destroySingletons(), and MediaWiki\MediaWikiServices\resetChildProcessServices().
Referenced by MediaWiki\Maintenance\ForkController\forkWorkers(), and MediaWiki\Maintenance\OrderedStreamingForkController\forkWorkers().
MediaWiki\Maintenance\ForkController::start | ( | ) |
Start the child processes.
This should only be called from the command line. It should be called as early as possible during execution.
This will return 'child' in the child processes. In the parent process, it will run until all the child processes exit or a TERM signal is received. It will then return 'done'.
Reimplemented in MediaWiki\Maintenance\OrderedStreamingForkController.
Definition at line 99 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\forkWorkers().
|
protected |
Definition at line 43 of file ForkController.php.
Referenced by MediaWiki\Maintenance\ForkController\getChildNumber().
|
protected |
Definition at line 40 of file ForkController.php.
|
protected |
Definition at line 49 of file ForkController.php.
Referenced by MediaWiki\Maintenance\ForkController\__construct().
|
protected |
Definition at line 52 of file ForkController.php.
|
staticprotected |
Definition at line 54 of file ForkController.php.
|
protected |
Definition at line 46 of file ForkController.php.