dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename Watchlist request parameters for consistency with RC's ones
[lhc/web/wiklou.git]
/
includes
/
ForkController.php
diff --git
a/includes/ForkController.php
b/includes/ForkController.php
index
448bc03
..
0582230
100644
(file)
--- a/
includes/ForkController.php
+++ b/
includes/ForkController.php
@@
-30,11
+30,11
@@
* @ingroup Maintenance
*/
class ForkController {
* @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,
SIGFPE,
SIGILL,
SIGSEGV,
@@
-53,7
+53,7
@@
class ForkController {
const RESTART_ON_ERROR = 1;
public function __construct( $numProcs, $flags = 0 ) {
const RESTART_ON_ERROR = 1;
public function __construct( $numProcs, $flags = 0 ) {
- if (
php_sapi_name()
!= 'cli' ) {
+ if (
PHP_SAPI
!= 'cli' ) {
throw new MWException( "ForkController cannot be used from the web." );
}
$this->procsToStart = $numProcs;
throw new MWException( "ForkController cannot be used from the web." );
}
$this->procsToStart = $numProcs;
@@
-121,7
+121,9
@@
class ForkController {
if ( function_exists( 'pcntl_signal_dispatch' ) ) {
pcntl_signal_dispatch();
} else {
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 ) {
}
// Respond to TERM signal
if ( $this->termReceived ) {
@@
-135,12
+137,22
@@
class ForkController {
return 'done';
}
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();
protected function prepareEnvironment() {
global $wgMemc;
// Don't share DB, storage, or memcached connections
wfGetLBFactory()->destroyInstance();
FileBackendGroup::destroySingleton();
- LockManagerGroup::destroySingleton();
+ LockManagerGroup::destroySingleton
s
();
ObjectCache::clear();
$wgMemc = null;
}
ObjectCache::clear();
$wgMemc = null;
}
@@
-164,6
+176,7
@@
class ForkController {
if ( !$pid ) {
$this->initChild();
if ( !$pid ) {
$this->initChild();
+ $this->childNumber = $i;
return 'child';
} else {
// This is the parent process
return 'child';
} else {
// This is the parent process