91 $services = $this->getServiceContainer();
95 $pathInfo = $this->environment->getServerInfo(
'PATH_INFO',
'' );
96 if ( $pathInfo !=
'' ) {
99 $request->getQueryValuesOnly()
101 $correctUrl = (string)$services->getUrlUtils()->expand(
106 "Location: $correctUrl",
111 'This endpoint does not support "path info", i.e. extra text ' .
112 'between "api.php" and the "?". Remove any such text and try again.'
121 'Badtitle/dummy title for API calls set in api.php'
139 (
new HookRunner( $services->getHookContainer() ) )->onApiBeforeMain( $processor );
140 if ( !$processor instanceof
ApiMain ) {
141 throw new LogicException(
142 'ApiBeforeMain hook set $processor to a non-ApiMain class'
145 }
catch ( Throwable $e ) {
153 $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(!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