76 $services = $this->getServiceContainer();
80 $pathInfo = $this->environment->getServerInfo(
'PATH_INFO',
'' );
81 if ( $pathInfo !=
'' ) {
84 $request->getQueryValuesOnly()
86 $correctUrl = (string)$services->getUrlUtils()->expand(
91 "Location: $correctUrl",
96 'This endpoint does not support "path info", i.e. extra text ' .
97 'between "api.php" and the "?". Remove any such text and try again.'
106 'Badtitle/dummy title for API calls set in api.php'
124 (
new HookRunner( $services->getHookContainer() ) )->onApiBeforeMain( $processor );
125 if ( !$processor instanceof
ApiMain ) {
126 throw new LogicException(
127 'ApiBeforeMain hook set $processor to a non-ApiMain class'
130 }
catch ( Throwable $e ) {
138 $processor->execute();
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfScript( $script='index')
Get the URL path to a MediaWiki entry point.
if(MW_ENTRY_POINT==='index') if(!defined( 'MW_NO_SESSION') &&MW_ENTRY_POINT !=='cli' $wgTitle
Implementation of the API entry point, for web browser navigations, usually via an Action or SpecialP...
execute()
Executes a request to the action API.
getContext()
Overwritten to narrow the return type to RequestContext.
__construct(RequestContext $context, EntryPointEnvironment $environment, MediaWikiServices $services)
This is the main API class, used for both external and internal processing.
static handleApiBeforeMainException(Throwable $e)
Handle a throwable from the ApiBeforeMain hook.
Group all the pieces relevant to the context of a request into one instance.
Utility class wrapping PHP runtime state.
Base class for entry point handlers.
EntryPointEnvironment $environment