MediaWiki master
MediaWiki\Rest\EntryPoint Class Reference

Inherits MediaWiki\MediaWikiEntryPoint.

Collaboration diagram for MediaWiki\Rest\EntryPoint:

Public Member Functions

 __construct (RequestInterface $request, RequestContext $context, EntryPointEnvironment $environment, MediaWikiServices $mediaWikiServices)
 
 execute ()
 Subclasses implement the entry point's functionality by overriding this method.
 
 setRouter (Router $router)
 Sets the router to use.
 
- 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().
 

Static Public Member Functions

static createRouter (MediaWikiServices $services, IContextSource $context, RequestInterface $request, ResponseFactory $responseFactory, CorsUtils $cors)
 
static getMainRequest ()
 
- 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 Member Functions

 doSetup ()
 Perform any setup needed before execute() is called.
 
- 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.
 
 doPrepareForOutput ()
 Prepare for sending the output.
 
 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)
 
 getContext ()
 
 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 ()
 
 handleTopLevelError (Throwable $e)
 Report a top level error.
 
 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.
 
 schedulePostSendJobs ()
 If enabled, after everything specific to this request is done, occasionally run jobs.
 
 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

- Protected Attributes inherited from MediaWiki\MediaWikiEntryPoint
EntryPointEnvironment $environment
 

Detailed Description

Access: internal

Definition at line 24 of file EntryPoint.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\EntryPoint::__construct ( RequestInterface $request,
RequestContext $context,
EntryPointEnvironment $environment,
MediaWikiServices $mediaWikiServices )

Definition at line 183 of file EntryPoint.php.

Member Function Documentation

◆ createRouter()

static MediaWiki\Rest\EntryPoint::createRouter ( MediaWikiServices $services,
IContextSource $context,
RequestInterface $request,
ResponseFactory $responseFactory,
CorsUtils $cors )
static
Access: internal
Public for use in core tests
Parameters
MediaWikiServices$services
IContextSource$context
RequestInterface$request
ResponseFactory$responseFactory
CorsUtils$cors
Returns
Router

Definition at line 41 of file EntryPoint.php.

◆ doSetup()

MediaWiki\Rest\EntryPoint::doSetup ( )
protected

Perform any setup needed before execute() is called.

Called by doRun() via doSetup().

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 99 of file EntryPoint.php.

References MediaWiki\Context\IContextSource\getUser(), and MediaWiki\Rest\ResponseFactory\setShowExceptionDetails().

◆ execute()

MediaWiki\Rest\EntryPoint::execute ( )

Subclasses implement the entry point's functionality by overriding this method.

This method is not safe to override for extensions.

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 204 of file EntryPoint.php.

◆ getMainRequest()

static MediaWiki\Rest\EntryPoint::getMainRequest ( )
static
Access: internal
Returns
RequestInterface The RequestInterface object used by this entry point.

Definition at line 86 of file EntryPoint.php.

References MediaWiki\MainConfigNames\CookiePrefix, and MediaWiki\MediaWikiServices\getInstance().

◆ setRouter()

MediaWiki\Rest\EntryPoint::setRouter ( Router $router)

Sets the router to use.

Intended for testing.

Parameters
Router$router

Definition at line 200 of file EntryPoint.php.


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