MediaWiki master
ApiHookRunner.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Api;
4
10
18class ApiHookRunner implements
64{
65
66 public function __construct( private readonly HookContainer $container ) {
67 }
68
70 public function onAPIAfterExecute( $module ) {
71 return $this->container->run(
72 'APIAfterExecute',
73 [ $module ]
74 );
75 }
76
78 public function onApiBlockSucceeded(
79 $module,
80 $performer,
81 $mainTarget,
82 $params,
83 &$additionalBlocksStatuses
84 ): void {
85 $this->container->run(
86 'ApiBlockSucceeded',
87 [ $module, $performer, $mainTarget, $params, &$additionalBlocksStatuses ]
88 );
89 }
90
92 public function onApiCheckCanExecute( $module, $user, &$message ) {
93 return $this->container->run(
94 'ApiCheckCanExecute',
95 [ $module, $user, &$message ]
96 );
97 }
98
100 public function onApiDeprecationHelp( &$msgs ) {
101 return $this->container->run(
102 'ApiDeprecationHelp',
103 [ &$msgs ]
104 );
105 }
106
108 public function onApiFeedContributions__feedItem( $row, $context, &$feedItem ) {
109 return $this->container->run(
110 'ApiFeedContributions::feedItem',
111 [ $row, $context, &$feedItem ]
112 );
113 }
114
116 public function onApiFormatHighlight( $context, $text, $mime, $format ) {
117 return $this->container->run(
118 'ApiFormatHighlight',
119 [ $context, $text, $mime, $format ]
120 );
121 }
122
124 public function onAPIGetAllowedParams( $module, &$params, $flags ) {
125 return $this->container->run(
126 'APIGetAllowedParams',
127 [ $module, &$params, $flags ]
128 );
129 }
130
132 public function onAPIGetDescriptionMessages( $module, &$msg ) {
133 return $this->container->run(
134 'APIGetDescriptionMessages',
135 [ $module, &$msg ]
136 );
137 }
138
140 public function onAPIGetParamDescriptionMessages( $module, &$msg ) {
141 return $this->container->run(
142 'APIGetParamDescriptionMessages',
143 [ $module, &$msg ]
144 );
145 }
146
148 public function onAPIHelpModifyOutput( $module, &$help, $options, &$tocData ) {
149 return $this->container->run(
150 'APIHelpModifyOutput',
151 [ $module, &$help, $options, &$tocData ]
152 );
153 }
154
156 public function onApiLogFeatureUsage( $feature, array $clientInfo ): void {
157 $this->container->run(
158 'ApiLogFeatureUsage',
159 [ $feature, $clientInfo ]
160 );
161 }
162
164 public function onApiMain__moduleManager( $moduleManager ) {
165 return $this->container->run(
166 'ApiMain::moduleManager',
167 [ $moduleManager ]
168 );
169 }
170
172 public function onApiMain__onException( $apiMain, $e ) {
173 return $this->container->run(
174 'ApiMain::onException',
175 [ $apiMain, $e ]
176 );
177 }
178
180 public function onApiMakeParserOptions( $options, $title, $params, $module,
181 &$reset, &$suppressCache
182 ) {
183 return $this->container->run(
184 'ApiMakeParserOptions',
185 [ $options, $title, $params, $module, &$reset, &$suppressCache ]
186 );
187 }
188
190 public function onApiMaxLagInfo( &$lagInfo ): void {
191 $this->container->run(
192 'ApiMaxLagInfo',
193 [ &$lagInfo ],
194 [ 'abortable' => false ]
195 );
196 }
197
199 public function onApiOpenSearchSuggest( &$results ) {
200 return $this->container->run(
201 'ApiOpenSearchSuggest',
202 [ &$results ]
203 );
204 }
205
207 public function onApiOptions( $apiModule, $user, $changes, $resetKinds ) {
208 return $this->container->run(
209 'ApiOptions',
210 [ $apiModule, $user, $changes, $resetKinds ]
211 );
212 }
213
215 public function onApiParseMakeOutputPage( $module, $output ) {
216 return $this->container->run(
217 'ApiParseMakeOutputPage',
218 [ $module, $output ]
219 );
220 }
221
223 public function onAPIQueryAfterExecute( $module ) {
224 return $this->container->run(
225 'APIQueryAfterExecute',
226 [ $module ]
227 );
228 }
229
231 public function onApiQueryBaseAfterQuery( $module, $result, &$hookData ) {
232 return $this->container->run(
233 'ApiQueryBaseAfterQuery',
234 [ $module, $result, &$hookData ]
235 );
236 }
237
239 public function onApiQueryBaseBeforeQuery( $module, &$tables, &$fields,
240 &$conds, &$query_options, &$join_conds, &$hookData
241 ) {
242 return $this->container->run(
243 'ApiQueryBaseBeforeQuery',
244 [ $module, &$tables, &$fields, &$conds, &$query_options,
245 &$join_conds, &$hookData ]
246 );
247 }
248
250 public function onApiQueryBaseProcessRow( $module, $row, &$data, &$hookData ) {
251 return $this->container->run(
252 'ApiQueryBaseProcessRow',
253 [ $module, $row, &$data, &$hookData ]
254 );
255 }
256
258 public function onApiQueryCheckCanExecute( $modules, $authority, &$message ) {
259 return $this->container->run(
260 'ApiQueryCheckCanExecute',
261 [ $modules, $authority, &$message ]
262 );
263 }
264
266 public function onAPIQueryGeneratorAfterExecute( $module, $resultPageSet ) {
267 return $this->container->run(
268 'APIQueryGeneratorAfterExecute',
269 [ $module, $resultPageSet ]
270 );
271 }
272
274 public function onAPIQuerySiteInfoGeneralInfo( $module, &$results ) {
275 return $this->container->run(
276 'APIQuerySiteInfoGeneralInfo',
277 [ $module, &$results ]
278 );
279 }
280
282 public function onAPIQuerySiteInfoStatisticsInfo( &$results ) {
283 return $this->container->run(
284 'APIQuerySiteInfoStatisticsInfo',
285 [ &$results ]
286 );
287 }
288
290 public function onApiQueryTokensRegisterTypes( &$salts ) {
291 return $this->container->run(
292 'ApiQueryTokensRegisterTypes',
293 [ &$salts ]
294 );
295 }
296
298 public function onApiQueryWatchlistExtractOutputData( $module, $watchedItem,
299 $recentChangeInfo, &$vals
300 ) {
301 return $this->container->run(
302 'ApiQueryWatchlistExtractOutputData',
303 [ $module, $watchedItem, $recentChangeInfo, &$vals ]
304 );
305 }
306
309 $module, $params, &$options
310 ) {
311 return $this->container->run(
312 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions',
313 [ $module, $params, &$options ]
314 );
315 }
316
318 public function onApiQuery__moduleManager( $moduleManager ) {
319 return $this->container->run(
320 'ApiQuery::moduleManager',
321 [ $moduleManager ]
322 );
323 }
324
326 public function onApiRsdServiceApis( &$apis ) {
327 return $this->container->run(
328 'ApiRsdServiceApis',
329 [ &$apis ]
330 );
331 }
332
334 public function onApiValidatePassword( $module, &$r ) {
335 return $this->container->run(
336 'ApiValidatePassword',
337 [ $module, &$r ]
338 );
339 }
340
342 public function onArticleParserOptions( Article $article, ParserOptions $popts ) {
343 return $this->container->run(
344 'ArticleParserOptions',
345 [ $article, $popts ]
346 );
347 }
348
350 public function onChangeAuthenticationDataAudit( $req, $status ) {
351 return $this->container->run(
352 'ChangeAuthenticationDataAudit',
353 [ $req, $status ]
354 );
355 }
356
358 public function onEditFormPreloadText( &$text, $title ) {
359 return $this->container->run(
360 'EditFormPreloadText',
361 [ &$text, $title ]
362 );
363 }
364
366 public function onFileUndeleteComplete( $title, $fileVersions, $user, $reason ) {
367 return $this->container->run(
368 'FileUndeleteComplete',
369 [ $title, $fileVersions, $user, $reason ]
370 );
371 }
372
374 public function onGetLinkColours( $pagemap, &$classes, $title ) {
375 return $this->container->run(
376 'GetLinkColours',
377 [ $pagemap, &$classes, $title ]
378 );
379 }
380
382 public function onImportSources( &$importSources ) {
383 return $this->container->run(
384 'ImportSources',
385 [ &$importSources ]
386 );
387 }
388
390 public function onLanguageLinks( $title, &$links, &$linkFlags ) {
391 return $this->container->run(
392 'LanguageLinks',
393 [ $title, &$links, &$linkFlags ]
394 );
395 }
396
398 public function onOutputPageBeforeHTML( $out, &$text ) {
399 return $this->container->run(
400 'OutputPageBeforeHTML',
401 [ $out, &$text ]
402 );
403 }
404
406 public function onOutputPageCheckLastModified( &$modifiedTimes, $out ) {
407 return $this->container->run(
408 'OutputPageCheckLastModified',
409 [ &$modifiedTimes, $out ]
410 );
411 }
412
415 return $this->container->run(
416 'RequestHasSameOriginSecurity',
417 [ $request ]
418 );
419 }
420
423 Session $session,
424 UserIdentity $user,
425 string $returnTo,
426 string $returnToQuery,
427 string $returnToAnchor,
428 &$redirectUrl
429 ) {
430 return $this->container->run(
431 'TempUserCreatedRedirect',
432 [ $session, $user, $returnTo, $returnToQuery, $returnToAnchor, &$redirectUrl ]
433 );
434 }
435
437 public function onUserLoginComplete( $user, &$inject_html, $direct ) {
438 return $this->container->run(
439 'UserLoginComplete',
440 [ $user, &$inject_html, $direct ]
441 );
442 }
443
445 public function onUserLogoutComplete( $user, &$inject_html, $oldName ) {
446 return $this->container->run(
447 'UserLogoutComplete',
448 [ $user, &$inject_html, $oldName ]
449 );
450 }
451}
This class provides an implementation of the hook interfaces used by the core Action API,...
onOutputPageBeforeHTML( $out, &$text)
This hook is called when a page has been processed by the parser and the resulting HTML is about to b...
onRequestHasSameOriginSecurity( $request)
Use this hook to determine if the request is somehow flagged to lack same-origin security....
onApiQueryCheckCanExecute( $modules, $authority, &$message)
This hook is called during at the beginning of ApiQuery::execute and can be used to prevent execution...
onAPIQueryGeneratorAfterExecute( $module, $resultPageSet)
This hook is called after calling the executeGenerator() method of an action=query submodule....
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 successf...
__construct(private readonly HookContainer $container)
onApiQueryTokensRegisterTypes(&$salts)
Use this hook to add additional token types to action=query&meta=tokens.Note that most modules will p...
onUserLoginComplete( $user, &$inject_html, $direct)
Use this hook to show custom content after a user has logged in via the web interface....
onEditFormPreloadText(&$text, $title)
Use this hook to populate the edit form when creating pages.1.35bool|void True or no return value to ...
onApiMakeParserOptions( $options, $title, $params, $module, &$reset, &$suppressCache)
This hook is called from ApiParse and ApiExpandTemplates to allow extensions to adjust the ParserOpti...
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.This hook is called in various places to allow ex...
onApiMain__moduleManager( $moduleManager)
This hook is called when ApiMain has finished initializing its module manager.Use this hook to condit...
onApiOpenSearchSuggest(&$results)
This hook is called when constructing the OpenSearch results.Hooks can alter or append to the array....
onGetLinkColours( $pagemap, &$classes, $title)
Use this hook to modify the CSS class of an array of page links.1.35bool|void True or no return value...
onArticleParserOptions(Article $article, ParserOptions $popts)
This hook is called before parsing wikitext for an article, and allows setting particular parser opti...
onApiQueryBaseProcessRow( $module, $row, &$data, &$hookData)
This hook is called for (some) API query modules as each row of the database result is processed....
onApiMaxLagInfo(&$lagInfo)
This hook is called when lag information is being requested via API.Use this hook to override lag inf...
onFileUndeleteComplete( $title, $fileVersions, $user, $reason)
This hook is called when a file is undeleted.1.35bool|void True or no return value to continue or fal...
onApiParseMakeOutputPage( $module, $output)
This hook is called when preparing the OutputPage object for ApiParse.This is mainly intended for cal...
onApiFeedContributions__feedItem( $row, $context, &$feedItem)
Use this hook to convert the result of ContribsPager into a MediaWiki\Feed\FeedItem instance that Api...
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....
onApiValidatePassword( $module, &$r)
This hook is called from ApiValidatePassword.1.35bool|void True or no return value to continue or fal...
onApiLogFeatureUsage( $feature, array $clientInfo)
This hook is called after calling the logFeatureUsage() method of an API module.Use this hook to exte...
onApiDeprecationHelp(&$msgs)
Use this hook to add messages to the 'deprecation-help' warning generated from ApiBase::addDeprecatio...
onAPIGetDescriptionMessages( $module, &$msg)
Use this hook to modify a module's help message.1.35bool|void True or no return value to continue or ...
onApiOptions( $apiModule, $user, $changes, $resetKinds)
This hook is called by action=options before applying changes to user preferences....
onOutputPageCheckLastModified(&$modifiedTimes, $out)
This hook is called when checking if the page has been modified since the last visit....
onApiCheckCanExecute( $module, $user, &$message)
This hook is called during ApiMain::checkExecutePermissions.Use this hook to further authenticate and...
onAPIHelpModifyOutput( $module, &$help, $options, &$tocData)
Use this hook to modify an API module's help output.1.35bool|void True or no return value to continue...
onApiFormatHighlight( $context, $text, $mime, $format)
Use this hook to syntax-highlight API pretty-printed output.1.35bool|void True or no return value to ...
onApiQuery__moduleManager( $moduleManager)
This hook is called when ApiQuery has finished initializing its module manager.Use this hook to condi...
onApiMain__onException( $apiMain, $e)
This hook is called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during A...
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...
onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions( $module, $params, &$options)
Use this hook to populate the options to be passed from ApiQueryWatchlist to WatchedItemQueryService....
onApiBlockSucceeded( $module, $performer, $mainTarget, $params, &$additionalBlocksStatuses)
This hook is called from ApiBlock.It allows callers to respond to a successful block with support for...
onAPIGetParamDescriptionMessages( $module, &$msg)
Use this hook to modify a module's parameter descriptions.1.35bool|void True or no return value to co...
onApiRsdServiceApis(&$apis)
Use this hook to add or remove APIs from the RSD services list.Each service should have its own entry...
onApiQueryWatchlistExtractOutputData( $module, $watchedItem, $recentChangeInfo, &$vals)
Use this hook to extract row data for ApiQueryWatchlist.1.35bool|void True or no return value to cont...
onAPIQuerySiteInfoGeneralInfo( $module, &$results)
Use this hook to add extra information to the site's general information.1.35bool|void True or no ret...
onChangeAuthenticationDataAudit( $req, $status)
This hook is called when a user changes their password.No return data is accepted; this hook is for a...
onUserLogoutComplete( $user, &$inject_html, $oldName)
This hook is called after a user has logged out.1.35bool|void True or no return value to continue or ...
onAPIGetAllowedParams( $module, &$params, $flags)
Use this hook to modify a module's parameters.1.35bool|void True or no return value to continue or fa...
onAPIAfterExecute( $module)
This hook is called after calling the execute() method of an API module.Use this hook to extend core ...
onAPIQuerySiteInfoStatisticsInfo(&$results)
Use this hook to add extra information to the site's statistics information.1.35bool|void True or no ...
Legacy class representing an editable page and handling UI for some page actions.
Definition Article.php:66
Set options of the Parser.
Manages data for an authenticated session.
Definition Session.php:38
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
This is a hook handler interface, see docs/Hooks.md.
Interface for objects representing user identity.