MediaWiki  1.23.12
MediaWiki Class Reference

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

Collaboration diagram for MediaWiki:

Public Member Functions

 __construct (IContextSource $context=null)
 
 getAction ()
 Returns the name of the action that will be executed. More...
 
 getTitle ()
 Get the Title object that we'll be acting on, as specified in the WebRequest. More...
 
 output (OutputPage $x=null)
 
 request (WebRequest $x=null)
 
 restInPeace ()
 Ends this task peacefully. More...
 
 run ()
 Run the current MediaWiki instance index.php just calls this. More...
 

Protected Member Functions

 triggerJobs ()
 Potentially open a socket and sent an HTTP request back to the server to run a specified number of jobs. More...
 

Private Member Functions

 checkMaxLag ()
 Checks if the request should abort due to a lagged server, for given maxlag parameter. More...
 
 initializeArticle ()
 Initialize the main Article object for "standard" actions (view, etc) Create an Article object for the page, following redirects if needed. More...
 
 main ()
 
 parseTitle ()
 Parse the request to get the Title object. More...
 
 performAction (Page $page, Title $requestTitle)
 Perform one of the "standard" actions. More...
 
 performRequest ()
 Performs the request. More...
 
 tryNormaliseRedirect (Title $title)
 Handle redirects for uncanonical title requests. More...
 

Private Attributes

String $action
 Cache what action this request is. More...
 
IContextSource $context
 TODO: fold $output, etc, into this. More...
 

Detailed Description

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

Definition at line 28 of file Wiki.php.

Constructor & Destructor Documentation

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

Definition at line 62 of file Wiki.php.

References $context, and RequestContext\getMain().

Member Function Documentation

MediaWiki::checkMaxLag ( )
private

Checks if the request should abort due to a lagged server, for given maxlag parameter.

Returns
bool

Definition at line 520 of file Wiki.php.

References global, list, wfGetLB(), wfProfileIn(), and wfProfileOut().

Referenced by run().

MediaWiki::getAction ( )

Returns the name of the action that will be executed.

Returns
string: action

Definition at line 150 of file Wiki.php.

References $action, action, and Action\getActionName().

Referenced by main(), and performAction().

MediaWiki::getTitle ( )

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

Returns
Title

Definition at line 138 of file Wiki.php.

References parseTitle().

Referenced by main(), triggerJobs(), and Preferences\tryUISubmit().

MediaWiki::initializeArticle ( )
private

Initialize the main Article object for "standard" actions (view, etc) Create an Article object for the page, following redirects if needed.

Returns
mixed an Article, or a string to redirect to another URL

Definition at line 373 of file Wiki.php.

References $article, $file, $title, array(), global, Article\newFromTitle(), Article\newFromWikiPage(), NS_FILE, NS_MEDIAWIKI, wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by performRequest().

MediaWiki::output ( OutputPage  $x = null)
Parameters
$xnull|OutputPage
Returns
OutputPage

Definition at line 49 of file Wiki.php.

MediaWiki::parseTitle ( )
private

Parse the request to get the Title object.

Returns
Title object to be $wgTitle

Definition at line 75 of file Wiki.php.

References $ret, $rev, $title, $wgContLang, ContextSource\getRequest(), SpecialPage\getTitleFor(), global, Title\makeTitle(), Revision\newFromId(), Title\newFromID(), Title\newFromURL(), Title\newMainPage(), NS_FILE, and NS_MEDIA.

Referenced by getTitle().

MediaWiki::performAction ( Page  $page,
Title  $requestTitle 
)
private

Perform one of the "standard" actions.

Parameters
$pagePage
$requestTitleThe original title, before any redirects were applied

Definition at line 456 of file Wiki.php.

References $output, $title, $user, array(), Action\factory(), getAction(), Title\getSquidURLs(), global, wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by performRequest().

MediaWiki::performRequest ( )
private

Performs the request.

  • bad titles
  • read restriction
  • local interwiki redirects
  • redirect loop
  • special pages
  • normal pages
Exceptions
MWException|PermissionsError|BadTitleError|HttpError
Returns
void

Definition at line 170 of file Wiki.php.

References $article, $output, $query, $title, $user, $wgTitle, action, array(), SpecialPageFactory\executePath(), SpecialPageFactory\getPage(), SpecialPage\getTitleFor(), global, initializeArticle(), list, NS_SPECIAL, performAction(), RedirectSpecialPage\personallyIdentifiableTarget(), SpecialPageFactory\resolveAlias(), tryNormaliseRedirect(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by main().

MediaWiki::request ( WebRequest  $x = null)
Parameters
$xnull|WebRequest
Returns
WebRequest

Definition at line 39 of file Wiki.php.

MediaWiki::restInPeace ( )

Ends this task peacefully.

Definition at line 663 of file Wiki.php.

References $factory, DeferredUpdates\doUpdates(), wfDebug(), wfGetLBFactory(), and wfLogProfilingData().

Referenced by run().

MediaWiki::run ( )

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

Definition at line 501 of file Wiki.php.

References $e, checkMaxLag(), MWExceptionHandler\handle(), main(), restInPeace(), and triggerJobs().

MediaWiki::triggerJobs ( )
protected

Potentially open a socket and sent an HTTP request back to the server to run a specified number of jobs.

This registers a callback to cleanup the socket once it's done.

Definition at line 683 of file Wiki.php.

References $n, $query, $section, array(), SpecialRunJobs\executeJobs(), SpecialRunJobs\getQuerySignature(), getTitle(), global, JobQueueGroup\singleton(), JobQueueGroup\TYPE_DEFAULT, wfAppendQuery(), wfDebugLog(), wfParseUrl(), wfReadOnly(), wfRestoreWarnings(), wfScript(), and wfSuppressWarnings().

Referenced by run().

MediaWiki::tryNormaliseRedirect ( Title  $title)
private

Handle redirects for uncanonical title requests.

Handles:

  • Redirect loops.
  • No title in URL.
  • $wgUsePathInfo URLs.
  • URLs with a variant.
  • Other non-standard URLs (as long as they have no extra query parameters).

Behaviour:

  • Normalise title values: /wiki/Foo%20Bar -> /wiki/Foo_Bar
  • Normalise empty title: /wiki/ -> /wiki/Main /w/index.php?title= -> /wiki/Main
  • Don't redirect anything with query parameters other than 'title' or 'action=view'.
Parameters
Title$title
Returns
bool True if a redirect was set.
Exceptions
HttpError

Definition at line 316 of file Wiki.php.

References $name, $output, array(), Title\getDBkey(), Title\getFullURL(), Title\getPrefixedDBkey(), SpecialPage\getTitleFor(), global, Title\isSpecialPage(), list, PROTO_CURRENT, SpecialPageFactory\resolveAlias(), Hooks\run(), and wfExpandUrl().

Referenced by performRequest().

Member Data Documentation

String MediaWiki::$action
private

Cache what action this request is.

Definition at line 57 of file Wiki.php.

Referenced by getAction().

IContextSource MediaWiki::$context
private

TODO: fold $output, etc, into this.

Definition at line 33 of file Wiki.php.

Referenced by __construct(), MediaWiki\Logger\BackcompatLogger\interpolate(), and MediaWiki\Logger\BackcompatLogger\log().


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