X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FForkController.php;h=2d5aa4b248f2e7f91040de225ce5c64bbee98d81;hb=220285ddd27b7f2971e9619940c48a8eee122cd0;hp=ced45af669c57fde741b75cbf2b01c08ad6822c4;hpb=7636bea2bf3ccc33389a97d968bdda64036f59c0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ForkController.php b/includes/ForkController.php index ced45af669..4a021ee1e5 100644 --- a/includes/ForkController.php +++ b/includes/ForkController.php @@ -30,11 +30,11 @@ * @ingroup Maintenance */ class ForkController { - var $children = array(); - var $termReceived = false; - var $flags = 0, $procsToStart = 0; + protected $children = array(), $childNumber = 0; + protected $termReceived = false; + protected $flags = 0, $procsToStart = 0; - static $restartableSignals = array( + protected static $restartableSignals = array( SIGFPE, SIGILL, SIGSEGV, @@ -137,19 +137,32 @@ 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 wfGetLBFactory()->destroyInstance(); FileBackendGroup::destroySingleton(); LockManagerGroup::destroySingletons(); + JobQueueGroup::destroySingletons(); ObjectCache::clear(); + RedisConnectionPool::destroySingletons(); $wgMemc = null; } /** * Fork a number of worker processes. * + * @param int $numProcs * @return string */ protected function forkWorkers( $numProcs ) { @@ -166,6 +179,7 @@ class ForkController { if ( !$pid ) { $this->initChild(); + $this->childNumber = $i; return 'child'; } else { // This is the parent process