MediaWiki master
|
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\ApiLogFeatureUsageHook, 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\Output\Hook\LanguageLinksHook, MediaWiki\Output\Hook\OutputPageBeforeHTMLHook, MediaWiki\Output\Hook\OutputPageCheckLastModifiedHook, MediaWiki\Page\Hook\ArticleParserOptionsHook, MediaWiki\Hook\TempUserCreatedRedirectHook, MediaWiki\Hook\UserLoginCompleteHook, MediaWiki\Hook\UserLogoutCompleteHook, and MediaWiki\SpecialPage\Hook\ChangeAuthenticationDataAuditHook.
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. | |
onApiLogFeatureUsage ( $feature, array $clientInfo) | |
This hook is called after calling the logFeatureUsage() method of an API module. | |
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. | |
onArticleParserOptions (Article $article, ParserOptions $popts) | |
This hook is called before parsing wikitext for an article, and allows setting particular parser options based on title, user preferences, etc. | |
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. | |
onTempUserCreatedRedirect (Session $session, UserIdentity $user, string $returnTo, string $returnToQuery, string $returnToAnchor, &$redirectUrl) | |
This hook is called after an action causes a temporary user to be created or after the first successful edit for a temporary account. | |
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. | |
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 18 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::__construct | ( | HookContainer | $container | ) |
Definition at line 65 of file ApiHookRunner.php.
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.
ApiBase | $module |
Implements MediaWiki\Api\Hook\APIAfterExecuteHook.
Definition at line 69 of file ApiHookRunner.php.
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.
ApiBase | $module | |
User | $user | Current user |
IApiMessage | Message | string | array | &$message | API message to die with. Specific values accepted depend on the MediaWiki version:
|
Implements MediaWiki\Api\Hook\ApiCheckCanExecuteHook.
Definition at line 76 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiDeprecationHelp | ( | & | $msgs | ) |
Use this hook to add messages to the 'deprecation-help' warning generated from ApiBase::addDeprecation().
Message[] | &$msgs | Messages to include in the help. Multiple messages will be joined with spaces. |
Implements MediaWiki\Api\Hook\ApiDeprecationHelpHook.
Definition at line 83 of file ApiHookRunner.php.
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.
stdClass | $row | A 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 | &$feedItem | Set 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. |
Implements MediaWiki\Api\Hook\ApiFeedContributions__feedItemHook.
Definition at line 90 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiFormatHighlight | ( | $context, | |
$text, | |||
$mime, | |||
$format ) |
Use this hook to syntax-highlight API pretty-printed output.
IContextSource | $context | |
string | $text | Text to be highlighted |
string | $mime | MIME type of $text |
string | $format | API format code for $text |
Implements MediaWiki\Api\Hook\ApiFormatHighlightHook.
Definition at line 97 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onAPIGetAllowedParams | ( | $module, | |
& | $params, | ||
$flags ) |
Use this hook to modify a module's parameters.
ApiBase | $module | |
array | &$params | Array of parameters |
int | $flags | Zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP |
Implements MediaWiki\Api\Hook\APIGetAllowedParamsHook.
Definition at line 104 of file ApiHookRunner.php.
References $params.
MediaWiki\Api\ApiHookRunner::onAPIGetDescriptionMessages | ( | $module, | |
& | $msg ) |
Use this hook to modify a module's help message.
ApiBase | $module | |
Message[] | &$msg |
Implements MediaWiki\Api\Hook\APIGetDescriptionMessagesHook.
Definition at line 111 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onAPIGetParamDescriptionMessages | ( | $module, | |
& | $msg ) |
Use this hook to modify a module's parameter descriptions.
ApiBase | $module | |
Message[][] | &$msg |
Implements MediaWiki\Api\Hook\APIGetParamDescriptionMessagesHook.
Definition at line 118 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onAPIHelpModifyOutput | ( | $module, | |
& | $help, | ||
$options, | |||
& | $tocData ) |
Use this hook to modify an API module's help output.
ApiBase | $module | |
string[] | &$help | Array of HTML strings to be joined for the output |
array | $options | Array of formatting options passed to ApiHelp::getHelp |
array | &$tocData | If a TOC is being generated, this array has keys as anchors in the page and values as for SectionMetadata::fromLegacy(). |
Implements MediaWiki\Api\Hook\APIHelpModifyOutputHook.
Definition at line 125 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiLogFeatureUsage | ( | $feature, | |
array | $clientInfo ) |
This hook is called after calling the logFeatureUsage() method of an API module.
Use this hook to extend core API modules.
string | $feature | |
array<string,mixed> | $clientInfo |
Implements MediaWiki\Api\Hook\ApiLogFeatureUsageHook.
Definition at line 132 of file ApiHookRunner.php.
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.
ApiModuleManager | $moduleManager |
Implements MediaWiki\Api\Hook\ApiMain__moduleManagerHook.
Definition at line 139 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiMain__onException | ( | $apiMain, | |
$e ) |
This hook is called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.
ApiMain | $apiMain | Calling ApiMain instance |
Throwable | $e |
Implements MediaWiki\Api\Hook\ApiMain__onExceptionHook.
Definition at line 146 of file ApiHookRunner.php.
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.
ParserOptions | $options | |
Title | $title | Title to be parsed |
array | $params | Parameter array for the API module |
ApiBase | $module | API module (which is also a ContextSource) |
ScopedCallback | null | &$reset | Set to a ScopedCallback used to reset any hooks after the parse is done |
bool | &$suppressCache | Set true if cache should be suppressed |
Implements MediaWiki\Api\Hook\ApiMakeParserOptionsHook.
Definition at line 153 of file ApiHookRunner.php.
References $params.
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'].
array | &$lagInfo | Maximum lag information array. Fields in the array are:
|
You can also add more fields that are returned to the user in the API response.
Implements MediaWiki\Api\Hook\ApiMaxLagInfoHook.
Definition at line 162 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiOpenSearchSuggest | ( | & | $results | ) |
This hook is called when constructing the OpenSearch results.
Hooks can alter or append to the array.
array[] | &$results | Array with integer keys to associative arrays. Keys in associative array:
|
Implements MediaWiki\Api\Hook\ApiOpenSearchSuggestHook.
Definition at line 170 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiOptions | ( | $apiModule, | |
$user, | |||
$changes, | |||
$resetKinds ) |
This hook is called by action=options before applying changes to user preferences.
ApiOptions | $apiModule | Calling ApiOptions object |
User | $user | User object whose preferences are being changed |
array | $changes | Associative array of preference name => value |
string[] | $resetKinds | Array of strings specifying which options kinds to reset See User::resetOptions() and User::getOptionKinds() for possible values. |
Implements MediaWiki\Api\Hook\ApiOptionsHook.
Definition at line 177 of file ApiHookRunner.php.
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().
ApiBase | $module | ApiBase (which is also a ContextSource) |
OutputPage | $output |
Implements MediaWiki\Api\Hook\ApiParseMakeOutputPageHook.
Definition at line 184 of file ApiHookRunner.php.
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.
ApiModuleManager | $moduleManager |
Implements MediaWiki\Api\Hook\ApiQuery__moduleManagerHook.
Definition at line 268 of file ApiHookRunner.php.
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.
ApiBase | $module |
Implements MediaWiki\Api\Hook\APIQueryAfterExecuteHook.
Definition at line 191 of file ApiHookRunner.php.
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.
ApiQueryBase | $module | Module in question |
IResultWrapper | $result | ResultWrapper |
array | &$hookData | Array that was passed to the ApiQueryBaseBeforeQuery hook and will be passed to the ApiQueryBaseProcessRow hook, intended for inter-hook communication |
Implements MediaWiki\Api\Hook\ApiQueryBaseAfterQueryHook.
Definition at line 198 of file ApiHookRunner.php.
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.
ApiQueryBase | $module | Module in question |
array | &$tables | Array of tables to be queried |
array | &$fields | Array of columns to select |
array | &$conds | Array of WHERE conditionals for query |
array | &$query_options | Array of options for the database request |
array | &$join_conds | Join conditions for the tables |
array | &$hookData | Array that will be passed to the ApiQueryBaseAfterQuery and ApiQueryBaseProcessRow hooks, intended for inter-hook communication. |
Implements MediaWiki\Api\Hook\ApiQueryBaseBeforeQueryHook.
Definition at line 205 of file ApiHookRunner.php.
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.
ApiQueryBase | $module | Module in question |
stdClass | $row | Database result row |
array | &$data | Array to be included in the ApiResult |
array | &$hookData | Array that was be passed to the ApiQueryBaseBeforeQuery and ApiQueryBaseAfterQuery hooks, intended for inter-hook communication |
Implements MediaWiki\Api\Hook\ApiQueryBaseProcessRowHook.
Definition at line 215 of file ApiHookRunner.php.
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.
ApiBase | $module | |
ApiPageSet | $resultPageSet |
Implements MediaWiki\Api\Hook\APIQueryGeneratorAfterExecuteHook.
Definition at line 222 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onAPIQuerySiteInfoGeneralInfo | ( | $module, | |
& | $results ) |
Use this hook to add extra information to the site's general information.
ApiQuerySiteinfo | $module | Current ApiQuerySiteinfo module |
array | &$results | Array of results, add things here |
Implements MediaWiki\Api\Hook\APIQuerySiteInfoGeneralInfoHook.
Definition at line 229 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onAPIQuerySiteInfoStatisticsInfo | ( | & | $results | ) |
Use this hook to add extra information to the site's statistics information.
array | &$results | Array of results, add things here |
Implements MediaWiki\Api\Hook\APIQuerySiteInfoStatisticsInfoHook.
Definition at line 236 of file ApiHookRunner.php.
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.
array | &$salts | [ type => salt to pass to User::getEditToken(), or array of salt and key to pass to Session::getToken() ] |
Implements MediaWiki\Api\Hook\ApiQueryTokensRegisterTypesHook.
Definition at line 243 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiQueryWatchlistExtractOutputData | ( | $module, | |
$watchedItem, | |||
$recentChangeInfo, | |||
& | $vals ) |
Use this hook to extract row data for ApiQueryWatchlist.
ApiQueryWatchlist | $module | |
WatchedItem | $watchedItem | |
array | $recentChangeInfo | Array of recent change info data |
array | &$vals | Associative array of data to be output for the row |
Implements MediaWiki\Api\Hook\ApiQueryWatchlistExtractOutputDataHook.
Definition at line 250 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions | ( | $module, | |
$params, | |||
& | $options ) |
Use this hook to populate the options to be passed from ApiQueryWatchlist to WatchedItemQueryService.
ApiQueryWatchlist | $module | |
array | $params | Array of parameters, as would be returned by $module->extractRequestParams() |
array | &$options | Array of options for WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo() |
Implements MediaWiki\Api\Hook\ApiQueryWatchlistPrepareWatchedItemQueryServiceOptionsHook.
Definition at line 259 of file ApiHookRunner.php.
References $params.
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.
array | &$apis | Array of services |
Implements MediaWiki\Api\Hook\ApiRsdServiceApisHook.
Definition at line 275 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onApiValidatePassword | ( | $module, | |
& | $r ) |
This hook is called from ApiValidatePassword.
ApiValidatePassword | $module | |
array | &$r | Result array |
Implements MediaWiki\Api\Hook\ApiValidatePasswordHook.
Definition at line 282 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onArticleParserOptions | ( | Article | $article, |
ParserOptions | $popts ) |
This hook is called before parsing wikitext for an article, and allows setting particular parser options based on title, user preferences, etc.
Implements MediaWiki\Page\Hook\ArticleParserOptionsHook.
Definition at line 289 of file ApiHookRunner.php.
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.
AuthenticationRequest | $req | Object describing the change (and target user) |
StatusValue | $status | StatusValue with the result of the action |
Implements MediaWiki\SpecialPage\Hook\ChangeAuthenticationDataAuditHook.
Definition at line 296 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onEditFormPreloadText | ( | & | $text, |
$title ) |
Use this hook to populate the edit form when creating pages.
string | &$text | Text to preload with |
Title | $title | Page being created |
Implements MediaWiki\Hook\EditFormPreloadTextHook.
Definition at line 303 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onFileUndeleteComplete | ( | $title, | |
$fileVersions, | |||
$user, | |||
$reason ) |
This hook is called when a file is undeleted.
Title | $title | Title object for the file |
int[] | $fileVersions | Array of undeleted filearchive IDs. Empty if all versions were restored. |
User | $user | User who performed the undeletion |
string | $reason |
Implements MediaWiki\Hook\FileUndeleteCompleteHook.
Definition at line 310 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onGetLinkColours | ( | $linkcolour_ids, | |
& | $colours, | ||
$title ) |
Use this hook to modify the CSS class of an array of page links.
string[] | $linkcolour_ids | Array 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 | $title | Title of the page being parsed, on which the links will be shown |
Implements MediaWiki\Hook\GetLinkColoursHook.
Definition at line 317 of file ApiHookRunner.php.
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.
array | &$importSources | The value of $wgImportSources. Modify as necessary. See \MediaWiki\MainConfigSchema::ImportSources. |
Implements MediaWiki\Hook\ImportSourcesHook.
Definition at line 324 of file ApiHookRunner.php.
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.
Title | $title | |
string[] | &$links | Array with elements of the form "language:title" in the order that they will be output |
array | &$linkFlags | Associative 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. |
Implements MediaWiki\Output\Hook\LanguageLinksHook.
Definition at line 331 of file ApiHookRunner.php.
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.
OutputPage | $out | OutputPage object that corresponds to the page |
string | &$text | Text that will be displayed, in HTML |
Implements MediaWiki\Output\Hook\OutputPageBeforeHTMLHook.
Definition at line 338 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onOutputPageCheckLastModified | ( | & | $modifiedTimes, |
$out ) |
This hook is called when checking if the page has been modified since the last visit.
string[] | &$modifiedTimes | Array of timestamps. The following keys are set: page, user, epoch. |
OutputPage | $out | since 1.28 |
Implements MediaWiki\Output\Hook\OutputPageCheckLastModifiedHook.
Definition at line 345 of file ApiHookRunner.php.
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.
WebRequest | $request |
Implements MediaWiki\Api\Hook\RequestHasSameOriginSecurityHook.
Definition at line 352 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onTempUserCreatedRedirect | ( | Session | $session, |
UserIdentity | $user, | ||
string | $returnTo, | ||
string | $returnToQuery, | ||
string | $returnToAnchor, | ||
& | $redirectUrl ) |
This hook is called after an action causes a temporary user to be created or after the first successful edit for a temporary account.
The handler may modify the redirect URL.
To differentiate between invocations of this hook where a) the account was created in the current request and b) the account existed, but made a first successful edit, one can examine the registration date of the account.
Session | $session | |
UserIdentity | $user | |
string | $returnTo | The prefixed DB key of the title to redirect to |
string | $returnToQuery | An extra query part |
string | $returnToAnchor | Either an empty string or a fragment beginning with "#" |
string | &$redirectUrl | The URL to redirect to |
Implements MediaWiki\Hook\TempUserCreatedRedirectHook.
Definition at line 359 of file ApiHookRunner.php.
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.
This includes both login and signup. It's also called by the action=login API (but not action=clientlogin or action=createaccount) for legacy reasons.
For functionality that needs to run after any login (API or web) use UserLoggedIn.
Before 1.42 this hook was also called when the user visited the login page with a returnto parameter while already logged in. Code that needs to run in that situation should use the PostLoginRedirect hook instead.
User | $user | The user object that was created on login |
string | &$inject_html | Any HTML to inject after the "logged in" message. (Setting it to a non-empty value will also prevent redirects: instead of the user being sent back to the page indicated by the returnto URL parameter, they will see a success page with $inject_html and a link to the returnto page.) On signup, the BeforeWelcomeCreation hook can further modify this value. |
bool | $direct | (bool) Unused, always true. Before 1.42, it was false when the hook was called in situations other than a successful login or signup; since 1.42 those don't happen anymore. |
Implements MediaWiki\Hook\UserLoginCompleteHook.
Definition at line 373 of file ApiHookRunner.php.
MediaWiki\Api\ApiHookRunner::onUserLogoutComplete | ( | $user, | |
& | $inject_html, | ||
$oldName ) |
This hook is called after a user has logged out.
User | $user | the user object after logout (won't have name, ID, etc.) |
string | &$inject_html | Any HTML to inject after the "logged out" message. |
string | $oldName | name of the user before logout (string) |
Implements MediaWiki\Hook\UserLogoutCompleteHook.
Definition at line 380 of file ApiHookRunner.php.