Go to the documentation of this file.
56 if ( PHP_SAPI !=
'cli' ) {
57 throw new MWException(
"ForkController cannot be used from the web." );
59 $this->procsToStart = $numProcs;
76 pcntl_signal( SIGTERM,
array( $this,
'handleTermSignal' ),
false );
80 if ( $this->procsToStart ) {
81 if ( $this->
forkWorkers( $this->procsToStart ) ==
'child' ) {
84 $this->procsToStart = 0;
89 $deadPid = pcntl_wait( $status );
93 unset( $this->children[$deadPid] );
94 if ( $this->
flags & self::RESTART_ON_ERROR ) {
95 if ( pcntl_wifsignaled( $status ) ) {
98 $signal = pcntl_wtermsig( $status );
99 if ( in_array( $signal, self::$restartableSignals ) ) {
100 echo
"Worker exited with signal $signal, restarting\n";
101 $this->procsToStart++;
103 } elseif ( pcntl_wifexited( $status ) ) {
105 $exitStatus = pcntl_wexitstatus( $status );
106 if ( $exitStatus != 0 ) {
107 echo
"Worker exited with status $exitStatus, restarting\n";
108 $this->procsToStart++;
110 echo
"Worker exited normally\n";
115 if ( $this->procsToStart ) {
121 if ( function_exists(
'pcntl_signal_dispatch' ) ) {
122 pcntl_signal_dispatch();
124 declare( ticks = 1 ) {
129 if ( $this->termReceived ) {
130 foreach ( $this->children
as $childPid => $unused ) {
131 posix_kill( $childPid, SIGTERM );
133 $this->termReceived =
false;
135 }
while ( count( $this->children ) );
136 pcntl_signal( SIGTERM, SIG_DFL );
169 for ( $i = 0; $i < $numProcs; $i++ ) {
172 if ( $pid === -1 || $pid ===
false ) {
173 echo
"Error creating child processes\n";
179 $this->childNumber = $i;
183 $this->children[$pid] =
true;
193 $this->children =
null;
194 pcntl_signal( SIGTERM, SIG_DFL );
198 $this->termReceived =
true;
static clear()
Clear all the cached instances.
const RESTART_ON_ERROR
Pass this flag to __construct() to cause the class to automatically restart workers that exit with no...
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static destroySingletons()
Destroy the singleton instances.
Class for managing forking command line scripts.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
handleTermSignal( $signal)
wfGetCache( $inputType)
Get a cache object.
start()
Start the child processes.
getChildNumber()
Get the number of the child currently running.
static destroySingleton()
Destroy the singleton instance.
forkWorkers( $numProcs)
Fork a number of worker processes.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as flags
& wfGetLBFactory()
Get the load balancer factory object.
CACHE_MEMCACHED $wgMainCacheType
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static $restartableSignals
__construct( $numProcs, $flags=0)