MediaWiki REL1_40
MediaWiki Class Reference

The MediaWiki class is the helper class for the index.php entry point. More...

Public Member Functions

 __construct (IContextSource $context=null)
 
 doPostOutputShutdown ()
 This function does work that can be done after the user gets the HTTP response so they don't block on it.
 
 getAction ()
 Returns the name of the action that will be executed.
 
 getTitle ()
 Get the Title object that we'll be acting on, as specified in the WebRequest.
 
 restInPeace ()
 Ends this task peacefully.
 
 run ()
 Run the current MediaWiki instance; index.php just calls this.
 

Static Public Member Functions

static emitBufferedStatsdData (IBufferingStatsdDataFactory $stats, Config $config)
 Send out any buffered statsd data according to sampling rules.
 
static preOutputCommit (IContextSource $context, $postCommitWork=null)
 This function commits all DB and session changes as needed before the client can receive a response (in case DB commit fails) and thus also before the response can trigger a subsequent related request by the client.
 

Detailed Description

The MediaWiki class is the helper class for the index.php entry point.

Definition at line 42 of file MediaWiki.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki::__construct ( IContextSource $context = null)
Parameters
IContextSource | null$context

Definition at line 62 of file MediaWiki.php.

Member Function Documentation

◆ doPostOutputShutdown()

MediaWiki::doPostOutputShutdown ( )

This function does work that can be done after the user gets the HTTP response so they don't block on it.

This manages deferred updates, job insertion, final commit, and the logging of profiling data

Since
1.26

Definition at line 826 of file MediaWiki.php.

◆ emitBufferedStatsdData()

static MediaWiki::emitBufferedStatsdData ( IBufferingStatsdDataFactory $stats,
Config $config )
static

Send out any buffered statsd data according to sampling rules.

For web requests, this is called once by MediaWiki::restInPeace(), which is post-send (after the response is sent to the client).

For maintenance scripts, especially long-running CLI scripts, it is called more often, to avoid OOM, since we buffer stats (T181385), based on the following heuristics:

  • Long-running scripts that involve database writes often use transactions to commit chunks of work. We flush from IDatabase::setTransactionListener, as wired up by MWLBFactory::applyGlobalState.
  • Long-running scripts that involve database writes but don't need any transactions will still periodically wait for replication to be graceful to the databases. We flush from ILBFactory::setWaitForReplicationListener as wired up by MWLBFactory::applyGlobalState.
  • Any other long-running scripts will probably report progress to stdout in some way. We also flush from Maintenance::output().
Parameters
IBufferingStatsdDataFactory$stats
Config$config
Exceptions
ConfigException
Since
1.31

Definition at line 1171 of file MediaWiki.php.

References IBufferingStatsdDataFactory\clearData(), Config\get(), IBufferingStatsdDataFactory\getData(), and IBufferingStatsdDataFactory\hasData().

◆ getAction()

MediaWiki::getAction ( )

Returns the name of the action that will be executed.

Returns
string Action

Definition at line 178 of file MediaWiki.php.

◆ getTitle()

MediaWiki::getTitle ( )

Get the Title object that we'll be acting on, as specified in the WebRequest.

Returns
Title

Definition at line 162 of file MediaWiki.php.

References SpecialPage\getTitleFor().

◆ preOutputCommit()

static MediaWiki::preOutputCommit ( IContextSource $context,
$postCommitWork = null )
static

This function commits all DB and session changes as needed before the client can receive a response (in case DB commit fails) and thus also before the response can trigger a subsequent related request by the client.

If there is a significant amount of content to flush, it can be done in $postCommitWork

Parameters
IContextSource$context
callable | null$postCommitWorkUnused as of MediaWiki 1.39
Since
1.27

Definition at line 671 of file MediaWiki.php.

References Config\get(), IContextSource\getConfig(), IContextSource\getOutput(), IContextSource\getRequest(), IContextSource\getUser(), wfDebug(), and wfDebugLog().

◆ restInPeace()

MediaWiki::restInPeace ( )

Ends this task peacefully.

Definition at line 1102 of file MediaWiki.php.

References wfDebug().

◆ run()

MediaWiki::run ( )

Run the current MediaWiki instance; index.php just calls this.

Definition at line 574 of file MediaWiki.php.

References IContextSource\getRequest(), IContextSource\getTitle(), HTMLFileCache\MODE_OUTAGE, and HTMLFileCache\useFileCache().


The documentation for this class was generated from the following file: