MediaWiki master
|
Manage forking inside CLI maintenance scripts. More...
Inherited by MediaWiki\Composer\ComposerLaunchParallel, and MediaWiki\Maintenance\OrderedStreamingForkController.
Public Member Functions | |
__construct ( $numProcs, $flags=0) | |
allSuccessful () | |
Return true if all completed child processes exited with an exit status / return code of 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[] | $exitStatuses = [] |
int | $flags = 0 |
int | $procsToStart = 0 |
bool | $termReceived = false |
Static Protected Attributes | |
static int[] | $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 37 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 69 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\$flags, and wfIsCLI().
MediaWiki\Maintenance\ForkController::allSuccessful | ( | ) |
Return true if all completed child processes exited with an exit status / return code of 0.
Definition at line 183 of file ForkController.php.
|
protected |
Fork a number of worker processes.
int | $numProcs |
Reimplemented in MediaWiki\Maintenance\OrderedStreamingForkController.
Definition at line 214 of file ForkController.php.
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 197 of file ForkController.php.
|
protected |
Definition at line 244 of file ForkController.php.
|
protected |
Definition at line 239 of file ForkController.php.
Referenced by MediaWiki\Maintenance\OrderedStreamingForkController\forkWorkers().
|
protected |
Reimplemented in MediaWiki\Composer\ComposerLaunchParallel.
Definition at line 201 of file ForkController.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MediaWikiServices\resetChildProcessServices().
Referenced by 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\Composer\ComposerLaunchParallel, and MediaWiki\Maintenance\OrderedStreamingForkController.
Definition at line 103 of file ForkController.php.
References MediaWiki\Maintenance\ForkController\forkWorkers().
|
protected |
Definition at line 42 of file ForkController.php.
|
protected |
Definition at line 39 of file ForkController.php.
|
protected |
Definition at line 57 of file ForkController.php.
|
protected |
Definition at line 48 of file ForkController.php.
Referenced by MediaWiki\Maintenance\ForkController\__construct().
|
protected |
Definition at line 51 of file ForkController.php.
|
staticprotected |
Definition at line 54 of file ForkController.php.
|
protected |
Definition at line 45 of file ForkController.php.