MediaWiki REL1_40
MediaWiki\Api\ApiHookRunner Class Reference

This class provides an implementation of the hook interfaces used by the core Action API, forwarding hook calls to HookContainer for dispatch to extensions. More...

Inherits MediaWiki\Api\Hook\APIAfterExecuteHook, MediaWiki\Api\Hook\ApiCheckCanExecuteHook, MediaWiki\Api\Hook\ApiDeprecationHelpHook, MediaWiki\Api\Hook\ApiFeedContributions__feedItemHook, MediaWiki\Api\Hook\ApiFormatHighlightHook, MediaWiki\Api\Hook\APIGetAllowedParamsHook, MediaWiki\Api\Hook\APIGetDescriptionMessagesHook, MediaWiki\Api\Hook\APIGetParamDescriptionMessagesHook, MediaWiki\Api\Hook\APIHelpModifyOutputHook, MediaWiki\Api\Hook\ApiMain__moduleManagerHook, MediaWiki\Api\Hook\ApiMain__onExceptionHook, MediaWiki\Api\Hook\ApiMakeParserOptionsHook, MediaWiki\Api\Hook\ApiMaxLagInfoHook, MediaWiki\Api\Hook\ApiOpenSearchSuggestHook, MediaWiki\Api\Hook\ApiOptionsHook, MediaWiki\Api\Hook\ApiParseMakeOutputPageHook, MediaWiki\Api\Hook\APIQueryAfterExecuteHook, MediaWiki\Api\Hook\ApiQueryBaseAfterQueryHook, MediaWiki\Api\Hook\ApiQueryBaseBeforeQueryHook, MediaWiki\Api\Hook\ApiQueryBaseProcessRowHook, MediaWiki\Api\Hook\APIQueryGeneratorAfterExecuteHook, MediaWiki\Api\Hook\APIQuerySiteInfoGeneralInfoHook, MediaWiki\Api\Hook\APIQuerySiteInfoStatisticsInfoHook, MediaWiki\Api\Hook\ApiQueryTokensRegisterTypesHook, MediaWiki\Api\Hook\ApiQueryWatchlistExtractOutputDataHook, MediaWiki\Api\Hook\ApiQueryWatchlistPrepareWatchedItemQueryServiceOptionsHook, MediaWiki\Api\Hook\ApiQuery__moduleManagerHook, MediaWiki\Api\Hook\ApiRsdServiceApisHook, MediaWiki\Api\Hook\ApiValidatePasswordHook, MediaWiki\Api\Hook\RequestHasSameOriginSecurityHook, MediaWiki\Hook\EditFormPreloadTextHook, MediaWiki\Hook\FileUndeleteCompleteHook, MediaWiki\Hook\GetLinkColoursHook, MediaWiki\Hook\ImportSourcesHook, MediaWiki\Hook\LanguageLinksHook, MediaWiki\Hook\OutputPageBeforeHTMLHook, MediaWiki\Hook\OutputPageCheckLastModifiedHook, MediaWiki\Hook\UserLoginCompleteHook, MediaWiki\Hook\UserLogoutCompleteHook, and MediaWiki\SpecialPage\Hook\ChangeAuthenticationDataAuditHook.

Collaboration diagram for MediaWiki\Api\ApiHookRunner:

Public Member Functions

 __construct (HookContainer $container)
 
 onAPIAfterExecute ( $module)
 This hook is called after calling the execute() method of an API module.
 
 onApiCheckCanExecute ( $module, $user, &$message)
 This hook is called during ApiMain::checkCanExecute.
 
 onApiDeprecationHelp (&$msgs)
 Use this hook to add messages to the 'deprecation-help' warning generated from ApiBase::addDeprecation().
 
 onApiFeedContributions__feedItem ( $row, $context, &$feedItem)
 Use this hook to convert the result of ContribsPager into a MediaWiki\Feed\FeedItem instance that ApiFeedContributions can consume.
 
 onApiFormatHighlight ( $context, $text, $mime, $format)
 Use this hook to syntax-highlight API pretty-printed output.
 
 onAPIGetAllowedParams ( $module, &$params, $flags)
 Use this hook to modify a module's parameters.
 
 onAPIGetDescriptionMessages ( $module, &$msg)
 Use this hook to modify a module's help message.
 
 onAPIGetParamDescriptionMessages ( $module, &$msg)
 Use this hook to modify a module's parameter descriptions.
 
 onAPIHelpModifyOutput ( $module, &$help, $options, &$tocData)
 Use this hook to modify an API module's help output.
 
 onApiMain__moduleManager ( $moduleManager)
 This hook is called when ApiMain has finished initializing its module manager.
 
 onApiMain__onException ( $apiMain, $e)
 This hook is called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.
 
 onApiMakeParserOptions ( $options, $title, $params, $module, &$reset, &$suppressCache)
 This hook is called from ApiParse and ApiExpandTemplates to allow extensions to adjust the ParserOptions before parsing.
 
 onApiMaxLagInfo (&$lagInfo)
 This hook is called when lag information is being requested via API.
 
 onApiOpenSearchSuggest (&$results)
 This hook is called when constructing the OpenSearch results.
 
 onApiOptions ( $apiModule, $user, $changes, $resetKinds)
 This hook is called by action=options before applying changes to user preferences.
 
 onApiParseMakeOutputPage ( $module, $output)
 This hook is called when preparing the OutputPage object for ApiParse.
 
 onApiQuery__moduleManager ( $moduleManager)
 This hook is called when ApiQuery has finished initializing its module manager.
 
 onAPIQueryAfterExecute ( $module)
 This hook is called after calling the execute() method of an action=query submodule.
 
 onApiQueryBaseAfterQuery ( $module, $result, &$hookData)
 This hook is called for (some) API query modules after the database query has returned.
 
 onApiQueryBaseBeforeQuery ( $module, &$tables, &$fields, &$conds, &$query_options, &$join_conds, &$hookData)
 This hook is called for (some) API query modules before a database query is made.
 
 onApiQueryBaseProcessRow ( $module, $row, &$data, &$hookData)
 This hook is called for (some) API query modules as each row of the database result is processed.
 
 onAPIQueryGeneratorAfterExecute ( $module, $resultPageSet)
 This hook is called after calling the executeGenerator() method of an action=query submodule.
 
 onAPIQuerySiteInfoGeneralInfo ( $module, &$results)
 Use this hook to add extra information to the site's general information.
 
 onAPIQuerySiteInfoStatisticsInfo (&$results)
 Use this hook to add extra information to the site's statistics information.
 
 onApiQueryTokensRegisterTypes (&$salts)
 Use this hook to add additional token types to action=query&meta=tokens.
 
 onApiQueryWatchlistExtractOutputData ( $module, $watchedItem, $recentChangeInfo, &$vals)
 Use this hook to extract row data for ApiQueryWatchlist.
 
 onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions ( $module, $params, &$options)
 Use this hook to populate the options to be passed from ApiQueryWatchlist to WatchedItemQueryService.
 
 onApiRsdServiceApis (&$apis)
 Use this hook to add or remove APIs from the RSD services list.
 
 onApiValidatePassword ( $module, &$r)
 This hook is called from ApiValidatePassword.
 
 onChangeAuthenticationDataAudit ( $req, $status)
 This hook is called when a user changes their password.
 
 onEditFormPreloadText (&$text, $title)
 Use this hook to populate the edit form when creating pages.
 
 onFileUndeleteComplete ( $title, $fileVersions, $user, $reason)
 This hook is called when a file is undeleted.
 
 onGetLinkColours ( $pagemap, &$classes, $title)
 Use this hook to modify the CSS class of an array of page links.
 
 onImportSources (&$importSources)
 This hook is called when reading from the $wgImportSources configuration variable.
 
 onLanguageLinks ( $title, &$links, &$linkFlags)
 Use this hook to manipulate a page's language links.
 
 onOutputPageBeforeHTML ( $out, &$text)
 This hook is called when a page has been processed by the parser and the resulting HTML is about to be displayed.
 
 onOutputPageCheckLastModified (&$modifiedTimes, $out)
 This hook is called when checking if the page has been modified since the last visit.
 
 onRequestHasSameOriginSecurity ( $request)
 Use this hook to determine if the request is somehow flagged to lack same-origin security.
 
 onUserLoginComplete ( $user, &$inject_html, $direct)
 Use this hook to show custom content after a user has logged in via the web interface.
 
 onUserLogoutComplete ( $user, &$inject_html, $oldName)
 This hook is called after a user has logged out.
 

Detailed Description

This class provides an implementation of the hook interfaces used by the core Action API, forwarding hook calls to HookContainer for dispatch to extensions.

To get an instance, use ApiBase::getHookRunner().

Definition at line 14 of file ApiHookRunner.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Api\ApiHookRunner::__construct ( HookContainer $container)

Definition at line 59 of file ApiHookRunner.php.

Member Function Documentation

◆ onAPIAfterExecute()

MediaWiki\Api\ApiHookRunner::onAPIAfterExecute ( $module)

This hook is called after calling the execute() method of an API module.

Use this hook to extend core API modules.

Since
1.35
Parameters
ApiBase$module
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIAfterExecuteHook.

Definition at line 63 of file ApiHookRunner.php.

◆ onApiCheckCanExecute()

MediaWiki\Api\ApiHookRunner::onApiCheckCanExecute ( $module,
$user,
& $message )

This hook is called during ApiMain::checkCanExecute.

Use this hook to further authenticate and authorize API clients before executing the module.

Since
1.35
Parameters
ApiBase$module
User$userCurrent user
IApiMessage | Message | string | array&$messageAPI message to die with. Specific values accepted depend on the MediaWiki version:
  • 1.29+: IApiMessage, Message, string message key, or key+parameters array to pass to ApiBase::dieWithError().
  • 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap.
  • Earlier: A key or key+parameters in ApiBase::$messageMap.
Returns
bool|void True or no return value to continue, or false and set a message to cancel the request

Implements MediaWiki\Api\Hook\ApiCheckCanExecuteHook.

Definition at line 70 of file ApiHookRunner.php.

◆ onApiDeprecationHelp()

MediaWiki\Api\ApiHookRunner::onApiDeprecationHelp ( & $msgs)

Use this hook to add messages to the 'deprecation-help' warning generated from ApiBase::addDeprecation().

Since
1.35
Parameters
Message[]&$msgsMessages to include in the help. Multiple messages will be joined with spaces.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiDeprecationHelpHook.

Definition at line 77 of file ApiHookRunner.php.

◆ onApiFeedContributions__feedItem()

MediaWiki\Api\ApiHookRunner::onApiFeedContributions__feedItem ( $row,
$context,
& $feedItem )

Use this hook to convert the result of ContribsPager into a MediaWiki\Feed\FeedItem instance that ApiFeedContributions can consume.

Implementors of this hook may cancel the hook to signal that the item is not viewable in the provided context.

Parameters
stdClass$rowA row of data from ContribsPager. The set of data returned by ContribsPager can be adjusted by handling the ContribsPager::reallyDoQuery hook.
IContextSource$context
\\MediaWiki\\Feed\\FeedItem | null&$feedItemSet this to a FeedItem instance if the callback can handle the provided row. This is provided to the hook as a null, if it is non-null then another callback has already handled the hook.
Returns
bool|void True or no return value to continue or false to abort
Since
1.35

Implements MediaWiki\Api\Hook\ApiFeedContributions__feedItemHook.

Definition at line 84 of file ApiHookRunner.php.

◆ onApiFormatHighlight()

MediaWiki\Api\ApiHookRunner::onApiFormatHighlight ( $context,
$text,
$mime,
$format )

Use this hook to syntax-highlight API pretty-printed output.

Since
1.35
Parameters
IContextSource$context
string$textText to be highlighted
string$mimeMIME type of $text
string$formatAPI format code for $text
Returns
bool|void True or no return value to continue, or false and add output to $context->getOutput() to highlight

Implements MediaWiki\Api\Hook\ApiFormatHighlightHook.

Definition at line 91 of file ApiHookRunner.php.

References $mime.

◆ onAPIGetAllowedParams()

MediaWiki\Api\ApiHookRunner::onAPIGetAllowedParams ( $module,
& $params,
$flags )

Use this hook to modify a module's parameters.

Since
1.35
Parameters
ApiBase$module
array&$paramsArray of parameters
int$flagsZero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIGetAllowedParamsHook.

Definition at line 98 of file ApiHookRunner.php.

◆ onAPIGetDescriptionMessages()

MediaWiki\Api\ApiHookRunner::onAPIGetDescriptionMessages ( $module,
& $msg )

Use this hook to modify a module's help message.

Since
1.35
Parameters
ApiBase$module
Message[]&$msg
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIGetDescriptionMessagesHook.

Definition at line 105 of file ApiHookRunner.php.

◆ onAPIGetParamDescriptionMessages()

MediaWiki\Api\ApiHookRunner::onAPIGetParamDescriptionMessages ( $module,
& $msg )

Use this hook to modify a module's parameter descriptions.

Since
1.35
Parameters
ApiBase$module
Message[][]&$msg
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIGetParamDescriptionMessagesHook.

Definition at line 112 of file ApiHookRunner.php.

◆ onAPIHelpModifyOutput()

MediaWiki\Api\ApiHookRunner::onAPIHelpModifyOutput ( $module,
& $help,
$options,
& $tocData )

Use this hook to modify an API module's help output.

Since
1.35
Parameters
ApiBase$module
string[]&$helpArray of HTML strings to be joined for the output
array$optionsArray of formatting options passed to ApiHelp::getHelp
array&$tocDataIf a TOC is being generated, this array has keys as anchors in the page and values as for Linker::generateTOC().
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIHelpModifyOutputHook.

Definition at line 119 of file ApiHookRunner.php.

◆ onApiMain__moduleManager()

MediaWiki\Api\ApiHookRunner::onApiMain__moduleManager ( $moduleManager)

This hook is called when ApiMain has finished initializing its module manager.

Use this hook to conditionally register API modules.

Since
1.35
Parameters
ApiModuleManager$moduleManager
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiMain__moduleManagerHook.

Definition at line 126 of file ApiHookRunner.php.

◆ onApiMain__onException()

MediaWiki\Api\ApiHookRunner::onApiMain__onException ( $apiMain,
$e )

This hook is called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.

Since
1.35
Parameters
ApiMain$apiMainCalling ApiMain instance
Throwable$e
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiMain__onExceptionHook.

Definition at line 133 of file ApiHookRunner.php.

◆ onApiMakeParserOptions()

MediaWiki\Api\ApiHookRunner::onApiMakeParserOptions ( $options,
$title,
$params,
$module,
& $reset,
& $suppressCache )

This hook is called from ApiParse and ApiExpandTemplates to allow extensions to adjust the ParserOptions before parsing.

Since
1.35
Parameters
ParserOptions$options
Title$titleTitle to be parsed
array$paramsParameter array for the API module
ApiBase$moduleAPI module (which is also a ContextSource)
ScopedCallback | null&$resetSet to a ScopedCallback used to reset any hooks after the parse is done
bool&$suppressCacheSet true if cache should be suppressed
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiMakeParserOptionsHook.

Definition at line 140 of file ApiHookRunner.php.

References $title.

◆ onApiMaxLagInfo()

MediaWiki\Api\ApiHookRunner::onApiMaxLagInfo ( & $lagInfo)

This hook is called when lag information is being requested via API.

Use this hook to override lag information. Generally a hook function should only replace $lagInfo if the new $lagInfo['lag'] is greater than the current $lagInfo['lag'].

Since
1.35
Parameters
array&$lagInfoMaximum lag information array. Fields in the array are:
  • lag: number of seconds of lag
  • host: host name on which the lag exists
  • type: an indication of the type of lag. For example: "db" for database replication lag or "jobqueue" for job queue size converted to pseudo-seconds

You can also add more fields that are returned to the user in the API response.

Returns
void This hook must not abort, it must return no value

Implements MediaWiki\Api\Hook\ApiMaxLagInfoHook.

Definition at line 149 of file ApiHookRunner.php.

◆ onApiOpenSearchSuggest()

MediaWiki\Api\ApiHookRunner::onApiOpenSearchSuggest ( & $results)

This hook is called when constructing the OpenSearch results.

Hooks can alter or append to the array.

Since
1.35
Parameters
array[]&$resultsArray with integer keys to associative arrays. Keys in associative array:
  • title: Title object
  • redirect from: Title or null
  • extract: Description for this result
  • extract trimmed: If truthy, the extract will not be trimmed to $wgOpenSearchDescriptionLength.
  • image: Thumbnail for this result. Value is an array with subkeys source (URL), width, height, alt, and align.
  • url: URL for the given title
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiOpenSearchSuggestHook.

Definition at line 157 of file ApiHookRunner.php.

◆ onApiOptions()

MediaWiki\Api\ApiHookRunner::onApiOptions ( $apiModule,
$user,
$changes,
$resetKinds )

This hook is called by action=options before applying changes to user preferences.

Since
1.35
Parameters
ApiOptions$apiModuleCalling ApiOptions object
User$userUser object whose preferences are being changed
array$changesAssociative array of preference name => value
string[]$resetKindsArray of strings specifying which options kinds to reset See User::resetOptions() and User::getOptionKinds() for possible values.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiOptionsHook.

Definition at line 164 of file ApiHookRunner.php.

◆ onApiParseMakeOutputPage()

MediaWiki\Api\ApiHookRunner::onApiParseMakeOutputPage ( $module,
$output )

This hook is called when preparing the OutputPage object for ApiParse.

This is mainly intended for calling OutputPage::addContentOverride() or OutputPage::addContentOverrideCallback().

Since
1.35
Parameters
ApiBase$moduleApiBase (which is also a ContextSource)
OutputPage$output
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiParseMakeOutputPageHook.

Definition at line 171 of file ApiHookRunner.php.

◆ onApiQuery__moduleManager()

MediaWiki\Api\ApiHookRunner::onApiQuery__moduleManager ( $moduleManager)

This hook is called when ApiQuery has finished initializing its module manager.

Use this hook to conditionally register API query modules.

Since
1.35
Parameters
ApiModuleManager$moduleManager
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQuery__moduleManagerHook.

Definition at line 255 of file ApiHookRunner.php.

◆ onAPIQueryAfterExecute()

MediaWiki\Api\ApiHookRunner::onAPIQueryAfterExecute ( $module)

This hook is called after calling the execute() method of an action=query submodule.

Use this hook to extend core API modules.

Since
1.35
Parameters
ApiBase$module
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQueryAfterExecuteHook.

Definition at line 178 of file ApiHookRunner.php.

◆ onApiQueryBaseAfterQuery()

MediaWiki\Api\ApiHookRunner::onApiQueryBaseAfterQuery ( $module,
$result,
& $hookData )

This hook is called for (some) API query modules after the database query has returned.

An API query module wanting to use this hook should see the ApiQueryBase::select() and ApiQueryBase::processRow() documentation.

Since
1.35
Parameters
ApiQueryBase$moduleModule in question
IResultWrapper$resultResultWrapper
array&$hookDataArray that was passed to the ApiQueryBaseBeforeQuery hook and will be passed to the ApiQueryBaseProcessRow hook, intended for inter-hook communication
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQueryBaseAfterQueryHook.

Definition at line 185 of file ApiHookRunner.php.

◆ onApiQueryBaseBeforeQuery()

MediaWiki\Api\ApiHookRunner::onApiQueryBaseBeforeQuery ( $module,
& $tables,
& $fields,
& $conds,
& $query_options,
& $join_conds,
& $hookData )

This hook is called for (some) API query modules before a database query is made.

WARNING: It would be very easy to misuse this hook and break the module! Any joins added must join on a unique key of the target table unless you really know what you're doing. An API query module wanting to use this hook should see the ApiQueryBase::select() and ApiQueryBase::processRow() documentation.

Since
1.35
Parameters
ApiQueryBase$moduleModule in question
array&$tablesArray of tables to be queried
array&$fieldsArray of columns to select
array&$condsArray of WHERE conditionals for query
array&$query_optionsArray of options for the database request
array&$join_condsJoin conditions for the tables
array&$hookDataArray that will be passed to the ApiQueryBaseAfterQuery and ApiQueryBaseProcessRow hooks, intended for inter-hook communication.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQueryBaseBeforeQueryHook.

Definition at line 192 of file ApiHookRunner.php.

◆ onApiQueryBaseProcessRow()

MediaWiki\Api\ApiHookRunner::onApiQueryBaseProcessRow ( $module,
$row,
& $data,
& $hookData )

This hook is called for (some) API query modules as each row of the database result is processed.

An API query module wanting to use this hook should see the ApiQueryBase::select() and ApiQueryBase::processRow() documentation.

Since
1.35
Parameters
ApiQueryBase$moduleModule in question
stdClass$rowDatabase result row
array&$dataArray to be included in the ApiResult
array&$hookDataArray that was be passed to the ApiQueryBaseBeforeQuery and ApiQueryBaseAfterQuery hooks, intended for inter-hook communication
Returns
bool|void True or no return value to continue, or false to stop processing the result set

Implements MediaWiki\Api\Hook\ApiQueryBaseProcessRowHook.

Definition at line 202 of file ApiHookRunner.php.

◆ onAPIQueryGeneratorAfterExecute()

MediaWiki\Api\ApiHookRunner::onAPIQueryGeneratorAfterExecute ( $module,
$resultPageSet )

This hook is called after calling the executeGenerator() method of an action=query submodule.

Use this hook to extend core API modules.

Since
1.35
Parameters
ApiBase$module
ApiPageSet$resultPageSet
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQueryGeneratorAfterExecuteHook.

Definition at line 209 of file ApiHookRunner.php.

◆ onAPIQuerySiteInfoGeneralInfo()

MediaWiki\Api\ApiHookRunner::onAPIQuerySiteInfoGeneralInfo ( $module,
& $results )

Use this hook to add extra information to the site's general information.

Since
1.35
Parameters
ApiQuerySiteinfo$moduleCurrent ApiQuerySiteinfo module
array&$resultsArray of results, add things here
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQuerySiteInfoGeneralInfoHook.

Definition at line 216 of file ApiHookRunner.php.

◆ onAPIQuerySiteInfoStatisticsInfo()

MediaWiki\Api\ApiHookRunner::onAPIQuerySiteInfoStatisticsInfo ( & $results)

Use this hook to add extra information to the site's statistics information.

Since
1.35
Parameters
array&$resultsArray of results, add things here
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQuerySiteInfoStatisticsInfoHook.

Definition at line 223 of file ApiHookRunner.php.

◆ onApiQueryTokensRegisterTypes()

MediaWiki\Api\ApiHookRunner::onApiQueryTokensRegisterTypes ( & $salts)

Use this hook to add additional token types to action=query&meta=tokens.

Note that most modules will probably be able to use the CSRF token instead of creating their own token types.

Since
1.35
Parameters
array&$salts[ type => salt to pass to User::getEditToken(), or array of salt and key to pass to Session::getToken() ]
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQueryTokensRegisterTypesHook.

Definition at line 230 of file ApiHookRunner.php.

◆ onApiQueryWatchlistExtractOutputData()

MediaWiki\Api\ApiHookRunner::onApiQueryWatchlistExtractOutputData ( $module,
$watchedItem,
$recentChangeInfo,
& $vals )

Use this hook to extract row data for ApiQueryWatchlist.

Since
1.35
Parameters
ApiQueryWatchlist$module
WatchedItem$watchedItem
array$recentChangeInfoArray of recent change info data
array&$valsAssociative array of data to be output for the row
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQueryWatchlistExtractOutputDataHook.

Definition at line 237 of file ApiHookRunner.php.

◆ onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions()

MediaWiki\Api\ApiHookRunner::onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions ( $module,
$params,
& $options )

Use this hook to populate the options to be passed from ApiQueryWatchlist to WatchedItemQueryService.

Since
1.35
Parameters
ApiQueryWatchlist$module
array$paramsArray of parameters, as would be returned by $module->extractRequestParams()
array&$optionsArray of options for WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiQueryWatchlistPrepareWatchedItemQueryServiceOptionsHook.

Definition at line 246 of file ApiHookRunner.php.

◆ onApiRsdServiceApis()

MediaWiki\Api\ApiHookRunner::onApiRsdServiceApis ( & $apis)

Use this hook to add or remove APIs from the RSD services list.

Each service should have its own entry in the $apis array and have a unique name, passed as key for the array that represents the service data. In this data array, the key-value-pair identified by the apiLink key is required.

Since
1.35
Parameters
array&$apisArray of services
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiRsdServiceApisHook.

Definition at line 262 of file ApiHookRunner.php.

◆ onApiValidatePassword()

MediaWiki\Api\ApiHookRunner::onApiValidatePassword ( $module,
& $r )

This hook is called from ApiValidatePassword.

Since
1.35
Parameters
ApiValidatePassword$module
array&$rResult array
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiValidatePasswordHook.

Definition at line 269 of file ApiHookRunner.php.

◆ onChangeAuthenticationDataAudit()

MediaWiki\Api\ApiHookRunner::onChangeAuthenticationDataAudit ( $req,
$status )

This hook is called when a user changes their password.

No return data is accepted; this hook is for auditing only.

Since
1.35
Parameters
AuthenticationRequest$reqObject describing the change (and target user)
StatusValue$statusStatusValue with the result of the action
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\SpecialPage\Hook\ChangeAuthenticationDataAuditHook.

Definition at line 276 of file ApiHookRunner.php.

◆ onEditFormPreloadText()

MediaWiki\Api\ApiHookRunner::onEditFormPreloadText ( & $text,
$title )

Use this hook to populate the edit form when creating pages.

Since
1.35
Parameters
string&$textText to preload with
Title$titlePage being created
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\EditFormPreloadTextHook.

Definition at line 283 of file ApiHookRunner.php.

References $title.

◆ onFileUndeleteComplete()

MediaWiki\Api\ApiHookRunner::onFileUndeleteComplete ( $title,
$fileVersions,
$user,
$reason )

This hook is called when a file is undeleted.

Since
1.35
Parameters
Title$titleTitle object for the file
int[]$fileVersionsArray of undeleted filearchive IDs. Empty if all versions were restored.
User$userUser who performed the undeletion
string$reason
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\FileUndeleteCompleteHook.

Definition at line 290 of file ApiHookRunner.php.

References $title.

◆ onGetLinkColours()

MediaWiki\Api\ApiHookRunner::onGetLinkColours ( $linkcolour_ids,
& $colours,
$title )

Use this hook to modify the CSS class of an array of page links.

Since
1.35
Parameters
string[]$linkcolour_idsArray of prefixed DB keys of the pages linked to, indexed by page_id
string[]&$colours(Output) Array of CSS classes, indexed by prefixed DB keys
Title$titleTitle of the page being parsed, on which the links will be shown
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\GetLinkColoursHook.

Definition at line 297 of file ApiHookRunner.php.

References $title.

◆ onImportSources()

MediaWiki\Api\ApiHookRunner::onImportSources ( & $importSources)

This hook is called when reading from the $wgImportSources configuration variable.

This can be used to lazy-load the import sources list.

Since
1.35
Parameters
array&$importSourcesThe value of $wgImportSources. Modify as necessary. See \MediaWiki\MainConfigSchema::ImportSources.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\ImportSourcesHook.

Definition at line 304 of file ApiHookRunner.php.

◆ onLanguageLinks()

MediaWiki\Api\ApiHookRunner::onLanguageLinks ( $title,
& $links,
& $linkFlags )

Use this hook to manipulate a page's language links.

This hook is called in various places to allow extensions to define the effective language links for a page.

Since
1.35
Parameters
Title$title
string[]&$linksArray with elements of the form "language:title" in the order that they will be output
array&$linkFlagsAssociative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\LanguageLinksHook.

Definition at line 311 of file ApiHookRunner.php.

References $title.

◆ onOutputPageBeforeHTML()

MediaWiki\Api\ApiHookRunner::onOutputPageBeforeHTML ( $out,
& $text )

This hook is called when a page has been processed by the parser and the resulting HTML is about to be displayed.

Since
1.35
Parameters
OutputPage$outOutputPage object that corresponds to the page
string&$textText that will be displayed, in HTML
Returns
bool|void This hook must not abort, it must return true or null.

Implements MediaWiki\Hook\OutputPageBeforeHTMLHook.

Definition at line 318 of file ApiHookRunner.php.

◆ onOutputPageCheckLastModified()

MediaWiki\Api\ApiHookRunner::onOutputPageCheckLastModified ( & $modifiedTimes,
$out )

This hook is called when checking if the page has been modified since the last visit.

Since
1.35
Parameters
string[]&$modifiedTimesArray of timestamps. The following keys are set: page, user, epoch.
OutputPage$outsince 1.28
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\OutputPageCheckLastModifiedHook.

Definition at line 325 of file ApiHookRunner.php.

◆ onRequestHasSameOriginSecurity()

MediaWiki\Api\ApiHookRunner::onRequestHasSameOriginSecurity ( $request)

Use this hook to determine if the request is somehow flagged to lack same-origin security.

Note that if the "somehow" involves HTTP headers, you'll probably need to make sure the header is varied on.

Since
1.35
Parameters
WebRequest$request
Returns
bool|void True or no return value to continue, or false to indicate a lack of same-origin security

Implements MediaWiki\Api\Hook\RequestHasSameOriginSecurityHook.

Definition at line 332 of file ApiHookRunner.php.

◆ onUserLoginComplete()

MediaWiki\Api\ApiHookRunner::onUserLoginComplete ( $user,
& $inject_html,
$direct )

Use this hook to show custom content after a user has logged in via the web interface.

For functionality that needs to run after any login (API or web) use UserLoggedIn.

Since
1.35
Parameters
User$userThe user object that was created on login
string&$inject_htmlAny HTML to inject after the "logged in" message.
bool$direct(bool) The hook is called directly after a successful login. This will only happen once per login. A UserLoginComplete call with direct=false can happen when the user visits the login page while already logged in.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\UserLoginCompleteHook.

Definition at line 339 of file ApiHookRunner.php.

◆ onUserLogoutComplete()

MediaWiki\Api\ApiHookRunner::onUserLogoutComplete ( $user,
& $inject_html,
$oldName )

This hook is called after a user has logged out.

Since
1.35
Parameters
User$userthe user object after logout (won't have name, ID, etc.)
string&$inject_htmlAny HTML to inject after the "logged out" message.
string$oldNamename of the user before logout (string)
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\UserLogoutCompleteHook.

Definition at line 346 of file ApiHookRunner.php.


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