MediaWiki REL1_35
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...

Inheritance diagram for MediaWiki\Api\ApiHookRunner:
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 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.
 
 onAPIQueryInfoTokens (&$tokenFunctions)
 Use this hook to add custom tokens to prop=info.
 
 onAPIQueryRecentChangesTokens (&$tokenFunctions)
 Use this hook to add custom tokens to list=recentchanges.
 
 onAPIQueryRevisionsTokens (&$tokenFunctions)
 Use this hook to add custom tokens to prop=revisions.
 
 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.
 
 onAPIQueryUsersTokens (&$tokenFunctions)
 Use this hook to add custom token to list=users.
 
 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.
 
 onApiTokensGetTokenTypes (&$tokenTypes)
 Use this hook to extend action=tokens with new token types.
 
 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.
 
 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.
 
 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.
 

Private Attributes

HookContainer $container
 

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 62 of file ApiHookRunner.php.

References MediaWiki\Api\ApiHookRunner\$container.

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$moduleModule object
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIAfterExecuteHook.

Definition at line 66 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$moduleModule object
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 73 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 80 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 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.

Since
1.35
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
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

Implements MediaWiki\Api\Hook\ApiFeedContributions__feedItemHook.

Definition at line 87 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 94 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$moduleModule object
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 101 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$moduleModule object
Message[]&$msgArray of Message objects
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIGetDescriptionMessagesHook.

Definition at line 108 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$moduleModule object
Message[][]&$msgArray of arrays of Message objects
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIGetParamDescriptionMessagesHook.

Definition at line 115 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$moduleModule object
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 122 of file ApiHookRunner.php.

References $help.

◆ 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 129 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 136 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 143 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 152 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 160 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 167 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 174 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 286 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$moduleModule object
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQueryAfterExecuteHook.

Definition at line 181 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 | bool$resultResultWrapper or bool returned from the IDatabase::select()
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 188 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 195 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 205 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$moduleModule object
ApiPageSet$resultPageSet
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\APIQueryGeneratorAfterExecuteHook.

Definition at line 212 of file ApiHookRunner.php.

◆ onAPIQueryInfoTokens()

MediaWiki\Api\ApiHookRunner::onAPIQueryInfoTokens ( $tokenFunctions)

Use this hook to add custom tokens to prop=info.

Every token has an action, which will be used in the intoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it. The prototype of the callback function is func($pageid, $title), where $pageid is the page ID of the page the token is requested for and $title is the associated Title object. In the hook, add your callback to the $tokenFunctions array and return true (returning false makes no sense).

Since
1.35
Parameters
array&$tokenFunctions[ action => callback ]
Returns
bool|void True or no return value

Implements MediaWiki\Api\Hook\APIQueryInfoTokensHook.

Definition at line 219 of file ApiHookRunner.php.

◆ onAPIQueryRecentChangesTokens()

MediaWiki\Api\ApiHookRunner::onAPIQueryRecentChangesTokens ( $tokenFunctions)

Use this hook to add custom tokens to list=recentchanges.

Every token has an action, which will be used in the rctoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it. The prototype of the callback function is func($pageid, $title, $rc), where $pageid is the page ID of the page associated to the revision the token is requested for, $title the associated Title object and $rc the associated RecentChange object. In the hook, add your callback to the $tokenFunctions array and return true (returning false makes no sense).

Since
1.35
Parameters
array&$tokenFunctions[ action => callback ]
Returns
bool|void True or no return value

Implements MediaWiki\Api\Hook\APIQueryRecentChangesTokensHook.

Definition at line 226 of file ApiHookRunner.php.

◆ onAPIQueryRevisionsTokens()

MediaWiki\Api\ApiHookRunner::onAPIQueryRevisionsTokens ( $tokenFunctions)

Use this hook to add custom tokens to prop=revisions.

Every token has an action, which will be used in the rvtoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it. The prototype of the callback function is func($pageid, $title, $rev), where $pageid is the page ID of the page associated to the revision the token is requested for, $title the associated Title object and $rev the associated Revision object. In the hook, add your callback to the $tokenFunctions array and return true (returning false makes no sense).

Since
1.35
Parameters
array&$tokenFunctions[ action => callback ]
Returns
bool|void True or no return value

Implements MediaWiki\Api\Hook\APIQueryRevisionsTokensHook.

Definition at line 233 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 240 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 247 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 254 of file ApiHookRunner.php.

Referenced by ApiQueryTokens\getTokenTypeSalts().

◆ onAPIQueryUsersTokens()

MediaWiki\Api\ApiHookRunner::onAPIQueryUsersTokens ( $tokenFunctions)

Use this hook to add custom token to list=users.

Every token has an action, which will be used in the ustoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it. The prototype of the callback function is func($user) where $user is the User object. In the hook, add your callback to the $tokenFunctions array and return true (returning false makes no sense).

Since
1.35
Parameters
array&$tokenFunctions[ action => callback ]
Returns
bool|void True or no return value

Implements MediaWiki\Api\Hook\APIQueryUsersTokensHook.

Definition at line 261 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 268 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 277 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 293 of file ApiHookRunner.php.

◆ onApiTokensGetTokenTypes()

MediaWiki\Api\ApiHookRunner::onApiTokensGetTokenTypes ( $tokenTypes)

Use this hook to extend action=tokens with new token types.

Since
1.35
Parameters
array&$tokenTypesSupported token types in format 'type' => callback function used to retrieve this type of token
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Api\Hook\ApiTokensGetTokenTypesHook.

Definition at line 300 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 307 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$reqAuthenticationRequest object 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 314 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 321 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 328 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 the comment in DefaultSettings.php for the detail of how to structure this array.
Returns
bool|void True or no return value to continue or false to abort

Implements MediaWiki\Hook\ImportSourcesHook.

Definition at line 335 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 342 of file ApiHookRunner.php.

References $title.

◆ 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 349 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 356 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 363 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 370 of file ApiHookRunner.php.

Member Data Documentation

◆ $container

HookContainer MediaWiki\Api\ApiHookRunner::$container
private

Definition at line 60 of file ApiHookRunner.php.

Referenced by MediaWiki\Api\ApiHookRunner\__construct().


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