MediaWiki master
ApiHookRunner.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Api;
4
10
18class ApiHookRunner implements
52 \MediaWiki\Hook\FileUndeleteCompleteHook,
53 \MediaWiki\Hook\GetLinkColoursHook,
54 \MediaWiki\Hook\ImportSourcesHook,
60 \MediaWiki\Hook\UserLoginCompleteHook,
61 \MediaWiki\Hook\UserLogoutCompleteHook,
63{
64 private HookContainer $container;
65
66 public function __construct( HookContainer $container ) {
67 $this->container = $container;
68 }
69
71 public function onAPIAfterExecute( $module ) {
72 return $this->container->run(
73 'APIAfterExecute',
74 [ $module ]
75 );
76 }
77
79 public function onApiCheckCanExecute( $module, $user, &$message ) {
80 return $this->container->run(
81 'ApiCheckCanExecute',
82 [ $module, $user, &$message ]
83 );
84 }
85
87 public function onApiDeprecationHelp( &$msgs ) {
88 return $this->container->run(
89 'ApiDeprecationHelp',
90 [ &$msgs ]
91 );
92 }
93
95 public function onApiFeedContributions__feedItem( $row, $context, &$feedItem ) {
96 return $this->container->run(
97 'ApiFeedContributions::feedItem',
98 [ $row, $context, &$feedItem ]
99 );
100 }
101
103 public function onApiFormatHighlight( $context, $text, $mime, $format ) {
104 return $this->container->run(
105 'ApiFormatHighlight',
106 [ $context, $text, $mime, $format ]
107 );
108 }
109
111 public function onAPIGetAllowedParams( $module, &$params, $flags ) {
112 return $this->container->run(
113 'APIGetAllowedParams',
114 [ $module, &$params, $flags ]
115 );
116 }
117
119 public function onAPIGetDescriptionMessages( $module, &$msg ) {
120 return $this->container->run(
121 'APIGetDescriptionMessages',
122 [ $module, &$msg ]
123 );
124 }
125
127 public function onAPIGetParamDescriptionMessages( $module, &$msg ) {
128 return $this->container->run(
129 'APIGetParamDescriptionMessages',
130 [ $module, &$msg ]
131 );
132 }
133
135 public function onAPIHelpModifyOutput( $module, &$help, $options, &$tocData ) {
136 return $this->container->run(
137 'APIHelpModifyOutput',
138 [ $module, &$help, $options, &$tocData ]
139 );
140 }
141
143 public function onApiLogFeatureUsage( $feature, array $clientInfo ): void {
144 $this->container->run(
145 'ApiLogFeatureUsage',
146 [ $feature, $clientInfo ]
147 );
148 }
149
151 public function onApiMain__moduleManager( $moduleManager ) {
152 return $this->container->run(
153 'ApiMain::moduleManager',
154 [ $moduleManager ]
155 );
156 }
157
159 public function onApiMain__onException( $apiMain, $e ) {
160 return $this->container->run(
161 'ApiMain::onException',
162 [ $apiMain, $e ]
163 );
164 }
165
167 public function onApiMakeParserOptions( $options, $title, $params, $module,
168 &$reset, &$suppressCache
169 ) {
170 return $this->container->run(
171 'ApiMakeParserOptions',
172 [ $options, $title, $params, $module, &$reset, &$suppressCache ]
173 );
174 }
175
177 public function onApiMaxLagInfo( &$lagInfo ): void {
178 $this->container->run(
179 'ApiMaxLagInfo',
180 [ &$lagInfo ],
181 [ 'abortable' => false ]
182 );
183 }
184
186 public function onApiOpenSearchSuggest( &$results ) {
187 return $this->container->run(
188 'ApiOpenSearchSuggest',
189 [ &$results ]
190 );
191 }
192
194 public function onApiOptions( $apiModule, $user, $changes, $resetKinds ) {
195 return $this->container->run(
196 'ApiOptions',
197 [ $apiModule, $user, $changes, $resetKinds ]
198 );
199 }
200
202 public function onApiParseMakeOutputPage( $module, $output ) {
203 return $this->container->run(
204 'ApiParseMakeOutputPage',
205 [ $module, $output ]
206 );
207 }
208
210 public function onAPIQueryAfterExecute( $module ) {
211 return $this->container->run(
212 'APIQueryAfterExecute',
213 [ $module ]
214 );
215 }
216
218 public function onApiQueryBaseAfterQuery( $module, $result, &$hookData ) {
219 return $this->container->run(
220 'ApiQueryBaseAfterQuery',
221 [ $module, $result, &$hookData ]
222 );
223 }
224
226 public function onApiQueryBaseBeforeQuery( $module, &$tables, &$fields,
227 &$conds, &$query_options, &$join_conds, &$hookData
228 ) {
229 return $this->container->run(
230 'ApiQueryBaseBeforeQuery',
231 [ $module, &$tables, &$fields, &$conds, &$query_options,
232 &$join_conds, &$hookData ]
233 );
234 }
235
237 public function onApiQueryBaseProcessRow( $module, $row, &$data, &$hookData ) {
238 return $this->container->run(
239 'ApiQueryBaseProcessRow',
240 [ $module, $row, &$data, &$hookData ]
241 );
242 }
243
245 public function onApiQueryCheckCanExecute( $modules, $authority, &$message ) {
246 return $this->container->run(
247 'ApiQueryCheckCanExecute',
248 [ $modules, $authority, &$message ]
249 );
250 }
251
253 public function onAPIQueryGeneratorAfterExecute( $module, $resultPageSet ) {
254 return $this->container->run(
255 'APIQueryGeneratorAfterExecute',
256 [ $module, $resultPageSet ]
257 );
258 }
259
261 public function onAPIQuerySiteInfoGeneralInfo( $module, &$results ) {
262 return $this->container->run(
263 'APIQuerySiteInfoGeneralInfo',
264 [ $module, &$results ]
265 );
266 }
267
269 public function onAPIQuerySiteInfoStatisticsInfo( &$results ) {
270 return $this->container->run(
271 'APIQuerySiteInfoStatisticsInfo',
272 [ &$results ]
273 );
274 }
275
277 public function onApiQueryTokensRegisterTypes( &$salts ) {
278 return $this->container->run(
279 'ApiQueryTokensRegisterTypes',
280 [ &$salts ]
281 );
282 }
283
285 public function onApiQueryWatchlistExtractOutputData( $module, $watchedItem,
286 $recentChangeInfo, &$vals
287 ) {
288 return $this->container->run(
289 'ApiQueryWatchlistExtractOutputData',
290 [ $module, $watchedItem, $recentChangeInfo, &$vals ]
291 );
292 }
293
296 $module, $params, &$options
297 ) {
298 return $this->container->run(
299 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions',
300 [ $module, $params, &$options ]
301 );
302 }
303
305 public function onApiQuery__moduleManager( $moduleManager ) {
306 return $this->container->run(
307 'ApiQuery::moduleManager',
308 [ $moduleManager ]
309 );
310 }
311
313 public function onApiRsdServiceApis( &$apis ) {
314 return $this->container->run(
315 'ApiRsdServiceApis',
316 [ &$apis ]
317 );
318 }
319
321 public function onApiValidatePassword( $module, &$r ) {
322 return $this->container->run(
323 'ApiValidatePassword',
324 [ $module, &$r ]
325 );
326 }
327
329 public function onArticleParserOptions( Article $article, ParserOptions $popts ) {
330 return $this->container->run(
331 'ArticleParserOptions',
332 [ $article, $popts ]
333 );
334 }
335
337 public function onChangeAuthenticationDataAudit( $req, $status ) {
338 return $this->container->run(
339 'ChangeAuthenticationDataAudit',
340 [ $req, $status ]
341 );
342 }
343
345 public function onEditFormPreloadText( &$text, $title ) {
346 return $this->container->run(
347 'EditFormPreloadText',
348 [ &$text, $title ]
349 );
350 }
351
353 public function onFileUndeleteComplete( $title, $fileVersions, $user, $reason ) {
354 return $this->container->run(
355 'FileUndeleteComplete',
356 [ $title, $fileVersions, $user, $reason ]
357 );
358 }
359
361 public function onGetLinkColours( $pagemap, &$classes, $title ) {
362 return $this->container->run(
363 'GetLinkColours',
364 [ $pagemap, &$classes, $title ]
365 );
366 }
367
369 public function onImportSources( &$importSources ) {
370 return $this->container->run(
371 'ImportSources',
372 [ &$importSources ]
373 );
374 }
375
377 public function onLanguageLinks( $title, &$links, &$linkFlags ) {
378 return $this->container->run(
379 'LanguageLinks',
380 [ $title, &$links, &$linkFlags ]
381 );
382 }
383
385 public function onOutputPageBeforeHTML( $out, &$text ) {
386 return $this->container->run(
387 'OutputPageBeforeHTML',
388 [ $out, &$text ]
389 );
390 }
391
393 public function onOutputPageCheckLastModified( &$modifiedTimes, $out ) {
394 return $this->container->run(
395 'OutputPageCheckLastModified',
396 [ &$modifiedTimes, $out ]
397 );
398 }
399
401 public function onRequestHasSameOriginSecurity( $request ) {
402 return $this->container->run(
403 'RequestHasSameOriginSecurity',
404 [ $request ]
405 );
406 }
407
410 Session $session,
411 UserIdentity $user,
412 string $returnTo,
413 string $returnToQuery,
414 string $returnToAnchor,
415 &$redirectUrl
416 ) {
417 return $this->container->run(
418 'TempUserCreatedRedirect',
419 [ $session, $user, $returnTo, $returnToQuery, $returnToAnchor, &$redirectUrl ]
420 );
421 }
422
424 public function onUserLoginComplete( $user, &$inject_html, $direct ) {
425 return $this->container->run(
426 'UserLoginComplete',
427 [ $user, &$inject_html, $direct ]
428 );
429 }
430
432 public function onUserLogoutComplete( $user, &$inject_html, $oldName ) {
433 return $this->container->run(
434 'UserLogoutComplete',
435 [ $user, &$inject_html, $oldName ]
436 );
437 }
438}
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...
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)
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)
onLanguageLinks( $title, &$links, &$linkFlags)
Use this hook to manipulate a page's language links.This hook is called in various places to allow ex...
__construct(HookContainer $container)
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)
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)
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....
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)
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:64
Set options of the Parser.
Manages data for an authenticated session.
Definition Session.php:37
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.