X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FForkController.php;h=05822302efaa58aaebd4fd13d215f6a811266132;hb=7ed38c84878181c1ee9f5e395fa60bc0019ee28a;hp=89ad9553857b4ab2454669b7ecfe069bcd5ea128;hpb=ed4db4af0a23379be7b452494a0e20c07458f6c0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ForkController.php b/includes/ForkController.php index 89ad955385..05822302ef 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, @@ -121,7 +121,9 @@ class ForkController { if ( function_exists( 'pcntl_signal_dispatch' ) ) { pcntl_signal_dispatch(); } else { - declare (ticks=1) { $status = $status; } + declare( ticks = 1 ) { + $status = $status; + } } // Respond to TERM signal if ( $this->termReceived ) { @@ -135,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 @@ -164,6 +176,7 @@ class ForkController { if ( !$pid ) { $this->initChild(); + $this->childNumber = $i; return 'child'; } else { // This is the parent process