From: Chad Horohoe Date: Wed, 8 Jan 2014 22:18:03 +0000 (-0800) Subject: Make it easy to get the number of the currently running child X-Git-Tag: 1.31.0-rc.0~17317^2 X-Git-Url: http://git.cyclocoop.org//%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/%22?a=commitdiff_plain;h=bcbe93086652449dee0315cce5e4c44e55bbb486;p=lhc%2Fweb%2Fwiklou.git Make it easy to get the number of the currently running child Change-Id: I2071f04b6f01e640c850c6470cfa9f2f48f62eac --- diff --git a/includes/ForkController.php b/includes/ForkController.php index 2d5aa4b248..05822302ef 100644 --- a/includes/ForkController.php +++ b/includes/ForkController.php @@ -30,7 +30,7 @@ * @ingroup Maintenance */ class ForkController { - protected $children = array(); + protected $children = array(), $childNumber = 0; protected $termReceived = false; protected $flags = 0, $procsToStart = 0; @@ -137,6 +137,16 @@ class ForkController { return 'done'; } + /** + * 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 + * @return int + */ + public function getChildNumber() { + return $this->childNumber; + } + protected function prepareEnvironment() { global $wgMemc; // Don't share DB, storage, or memcached connections @@ -166,6 +176,7 @@ class ForkController { if ( !$pid ) { $this->initChild(); + $this->childNumber = $i; return 'child'; } else { // This is the parent process