MediaWiki master
MediaWiki\Actions\ActionEntryPoint Class Reference

The index.php entry point for web browser navigations, usually routed to an Action or SpecialPage subclass. More...

Inherits MediaWiki\MediaWikiEntryPoint.

Collaboration diagram for MediaWiki\Actions\ActionEntryPoint:

Public Member Functions

 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.
 
- Public Member Functions inherited from MediaWiki\MediaWikiEntryPoint
 __construct (IContextSource $context, EntryPointEnvironment $environment, MediaWikiServices $mediaWikiServices)
 
 enableOutputCapture ()
 Enable capturing of the current output buffer.
 
 getCapturedOutput ()
 Stop capturing and return all output.
 
 getRequestPathSuffix ( $basePath)
 If the request URL matches a given base path, extract the path part of the request URL after that base, and decode escape sequences in it.
 
 run ()
 Main app life cycle: Calls doSetup(), execute(), prepareForOutput(), and postOutputShutdown().
 

Protected Member Functions

 doPrepareForOutput ()
 Prepare for sending the output.
 
 execute ()
 Determine and send the response headers and body for this web request.
 
 getContext ()
 Overwritten to narrow the return type to RequestContext.
 
 getOutput ()
 
 getUser ()
 
 handleTopLevelError (Throwable $e)
 Report a top level error.
 
 initializeArticle ()
 Initialize the main Article object for "standard" actions (view, etc) Create an Article object for the page, following redirects if needed.
 
 maybeDoHttpsRedirect ()
 If the stars are suitably aligned, do an HTTP->HTTPS redirect.
 
 parseTitle ( $request)
 Parse the request to get the Title object.
 
 performAction (Article $article, Title $requestTitle)
 Perform one of the "standard" actions.
 
 performRequest ()
 Performs the request.
 
 schedulePostSendJobs ()
 If enabled, after everything specific to this request is done, occasionally run jobs.
 
 tryNormaliseRedirect (Title $title)
 Handle redirects for uncanonical title requests.
 
- Protected Member Functions inherited from MediaWiki\MediaWikiEntryPoint
 commitMainTransaction ()
 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.
 
 commitOutputBuffer ()
 Ends the current output buffer, appending its content to the parent buffer.
 
 disableModDeflate ()
 
 discardAllOutput ()
 Discards all buffered output, down to the capture buffer level.
 
 discardOutputBuffer ()
 
 doPostOutputShutdown ()
 Forces the response to be sent to the client and then does work that can be done after the user gets the HTTP response, so they don't block on it.
 
 doSetup ()
 Perform any setup needed before execute() is called.
 
 drainOutputBuffer ()
 Returns the content of the current output buffer and clears it.
 
 enterPostSendMode ()
 Disables all output to the client.
 
 exit (int $code=0)
 
 fastCgiFinishRequest ()
 Calls fastcgi_finish_request if possible.
 
 flushOutputBuffer ()
 Flush buffered output to the client.
 
 getBlockManager ()
 
 getConfig (string $key)
 
 getDBLoadBalancerFactory ()
 
 getEnv (string $name)
 Returns the value of an environment variable.
 
 getIni (string $name)
 Returns the value of an ini option.
 
 getJobQueueGroupFactory ()
 
 getJobRunner ()
 
 getMessageCache ()
 
 getOutputBufferLength ()
 
 getOutputBufferLevel ()
 Returns the output buffer level.
 
 getOutputBufferStatus ()
 
 getReadOnlyMode ()
 
 getRequest ()
 
 getRequestURL ()
 Returns the current request's path and query string (not a full URL), like PHP's built-in $_SERVER['REQUEST_URI'].
 
 getResponse ()
 
 getServerInfo (string $key, $default=null)
 
 getServiceContainer ()
 Returns the main service container.
 
 getSpecialPageFactory ()
 
 getStatsdDataFactory ()
 
 getStatsFactory ()
 
 getStatusCode ()
 
 getUrlUtils ()
 
 hasFastCgi ()
 
 header (string $header, bool $replace=true, int $status=0)
 
 inPostSendMode ()
 Whether enterPostSendMode() has been called.
 
 isCli ()
 
 outputResponsePayload ( $content)
 Print a response body to the current buffer (if there is one) or the server (otherwise)
 
 postOutputShutdown ()
 Forces the response to be sent to the client and then does work that can be done after the user gets the HTTP response, so they don't block on it.
 
 prepareForOutput ()
 Prepare for sending the output.
 
 print ( $data)
 
 restInPeace ()
 Ends this task peacefully.
 
 setIniOption (string $name, $value)
 
 setup ()
 Perform any setup needed before execute() is called.
 
 shouldDoHttpRedirect ()
 Check if an HTTP->HTTPS redirect should be done.
 
 startOutputBuffer (?callable $callback=null)
 Adds a new output buffer level.
 
 status (int $code)
 
 triggerAsyncJobs ( $n, LoggerInterface $runJobsLogger)
 
 triggerError (string $message, int $level=E_USER_NOTICE)
 Triggers a PHP runtime error.
 
 triggerSyncJobs ( $n)
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\MediaWikiEntryPoint
static emitBufferedStatsdData (IBufferingStatsdDataFactory $stats, Config $config)
 Send out any buffered statsd data according to sampling rules.
 
- Protected Attributes inherited from MediaWiki\MediaWikiEntryPoint
EntryPointEnvironment $environment
 

Detailed Description

The index.php entry point for web browser navigations, usually routed to an Action or SpecialPage subclass.

Access: internal
For use in index.php

Definition at line 41 of file ActionEntryPoint.php.

Member Function Documentation

◆ doPrepareForOutput()

MediaWiki\Actions\ActionEntryPoint::doPrepareForOutput ( )
protected

Prepare for sending the output.

Should be called by entry points before sending the response. Will be called automatically by run() via prepareForOutput(). Subclasses may override this method, but should not call it directly.

Note
arc-lamp profiling relies on the name of this method, it's hard coded in the arclamp-generate-svgs script!

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 208 of file ActionEntryPoint.php.

◆ execute()

MediaWiki\Actions\ActionEntryPoint::execute ( )
protected

Determine and send the response headers and body for this web request.

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 88 of file ActionEntryPoint.php.

References $wgTitle, getTitle(), Profiler\instance(), and ErrorPageError\report().

◆ getAction()

MediaWiki\Actions\ActionEntryPoint::getAction ( )

Returns the name of the action that will be executed.

Note
This is public for the benefit of extensions that implement the BeforeInitialize or MediaWikiPerformAction hooks.
Returns
string Action

Definition at line 348 of file ActionEntryPoint.php.

◆ getContext()

MediaWiki\Actions\ActionEntryPoint::getContext ( )
protected

Overwritten to narrow the return type to RequestContext.

Returns
RequestContext

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 47 of file ActionEntryPoint.php.

◆ getOutput()

MediaWiki\Actions\ActionEntryPoint::getOutput ( )
protected

Definition at line 55 of file ActionEntryPoint.php.

◆ getTitle()

MediaWiki\Actions\ActionEntryPoint::getTitle ( )

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

Returns
Title

Definition at line 327 of file ActionEntryPoint.php.

◆ getUser()

MediaWiki\Actions\ActionEntryPoint::getUser ( )
protected

Definition at line 59 of file ActionEntryPoint.php.

◆ handleTopLevelError()

MediaWiki\Actions\ActionEntryPoint::handleTopLevelError ( Throwable $e)
protected

Report a top level error.

Subclasses in core may override this to handle errors according to the expected output format. This method is not safe to override for extensions.

Parameters
Throwable$e

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 63 of file ActionEntryPoint.php.

◆ initializeArticle()

MediaWiki\Actions\ActionEntryPoint::initializeArticle ( )
protected

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

Returns
Article|string An Article, or a string to redirect to another URL

Definition at line 607 of file ActionEntryPoint.php.

References wfWarn().

◆ maybeDoHttpsRedirect()

MediaWiki\Actions\ActionEntryPoint::maybeDoHttpsRedirect ( )
protected

If the stars are suitably aligned, do an HTTP->HTTPS redirect.

Note: Do this after $wgTitle is setup, otherwise the hooks run from isRegistered() will do all sorts of weird stuff.

Returns
bool True if the redirect was done. Handling of the request should be aborted. False if no redirect was done.

Definition at line 175 of file ActionEntryPoint.php.

References NS_MAIN, and wfDebugLog().

◆ parseTitle()

MediaWiki\Actions\ActionEntryPoint::parseTitle ( $request)
protected

Parse the request to get the Title object.

Exceptions
MalformedTitleExceptionIf a title has been provided by the user, but is invalid.
Parameters
WebRequest$request
Returns
Title Title object to be $wgTitle

Definition at line 231 of file ActionEntryPoint.php.

References NS_FILE, and NS_MEDIA.

◆ performAction()

MediaWiki\Actions\ActionEntryPoint::performAction ( Article $article,
Title $requestTitle )
protected

Perform one of the "standard" actions.

Parameters
Article$article
Title$requestTitleThe original title, before any redirects were applied

Definition at line 690 of file ActionEntryPoint.php.

References getTitle(), Profiler\instance(), and MW_ENTRY_POINT.

◆ performRequest()

MediaWiki\Actions\ActionEntryPoint::performRequest ( )
protected

Performs the request.

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

Definition at line 364 of file ActionEntryPoint.php.

References $url, $wgTitle, and MediaWiki\User\Options\UserOptionsLookup\getBoolOption().

◆ schedulePostSendJobs()

MediaWiki\Actions\ActionEntryPoint::schedulePostSendJobs ( )
protected

If enabled, after everything specific to this request is done, occasionally run jobs.

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 215 of file ActionEntryPoint.php.

References getTitle().

◆ tryNormaliseRedirect()

MediaWiki\Actions\ActionEntryPoint::tryNormaliseRedirect ( Title $title)
protected

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 544 of file ActionEntryPoint.php.


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