MediaWiki master
ApiHookRunner.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Api;
4
8
16class ApiHookRunner implements
59{
60 private HookContainer $container;
61
62 public function __construct( HookContainer $container ) {
63 $this->container = $container;
64 }
65
66 public function onAPIAfterExecute( $module ) {
67 return $this->container->run(
68 'APIAfterExecute',
69 [ $module ]
70 );
71 }
72
73 public function onApiCheckCanExecute( $module, $user, &$message ) {
74 return $this->container->run(
75 'ApiCheckCanExecute',
76 [ $module, $user, &$message ]
77 );
78 }
79
80 public function onApiDeprecationHelp( &$msgs ) {
81 return $this->container->run(
82 'ApiDeprecationHelp',
83 [ &$msgs ]
84 );
85 }
86
87 public function onApiFeedContributions__feedItem( $row, $context, &$feedItem ) {
88 return $this->container->run(
89 'ApiFeedContributions::feedItem',
90 [ $row, $context, &$feedItem ]
91 );
92 }
93
94 public function onApiFormatHighlight( $context, $text, $mime, $format ) {
95 return $this->container->run(
96 'ApiFormatHighlight',
97 [ $context, $text, $mime, $format ]
98 );
99 }
100
101 public function onAPIGetAllowedParams( $module, &$params, $flags ) {
102 return $this->container->run(
103 'APIGetAllowedParams',
104 [ $module, &$params, $flags ]
105 );
106 }
107
108 public function onAPIGetDescriptionMessages( $module, &$msg ) {
109 return $this->container->run(
110 'APIGetDescriptionMessages',
111 [ $module, &$msg ]
112 );
113 }
114
115 public function onAPIGetParamDescriptionMessages( $module, &$msg ) {
116 return $this->container->run(
117 'APIGetParamDescriptionMessages',
118 [ $module, &$msg ]
119 );
120 }
121
122 public function onAPIHelpModifyOutput( $module, &$help, $options, &$tocData ) {
123 return $this->container->run(
124 'APIHelpModifyOutput',
125 [ $module, &$help, $options, &$tocData ]
126 );
127 }
128
129 public function onApiLogFeatureUsage( $feature, array $clientInfo ): void {
130 $this->container->run(
131 'ApiLogFeatureUsage',
132 [ $feature, $clientInfo ]
133 );
134 }
135
136 public function onApiMain__moduleManager( $moduleManager ) {
137 return $this->container->run(
138 'ApiMain::moduleManager',
139 [ $moduleManager ]
140 );
141 }
142
143 public function onApiMain__onException( $apiMain, $e ) {
144 return $this->container->run(
145 'ApiMain::onException',
146 [ $apiMain, $e ]
147 );
148 }
149
150 public function onApiMakeParserOptions( $options, $title, $params, $module,
151 &$reset, &$suppressCache
152 ) {
153 return $this->container->run(
154 'ApiMakeParserOptions',
155 [ $options, $title, $params, $module, &$reset, &$suppressCache ]
156 );
157 }
158
159 public function onApiMaxLagInfo( &$lagInfo ): void {
160 $this->container->run(
161 'ApiMaxLagInfo',
162 [ &$lagInfo ],
163 [ 'abortable' => false ]
164 );
165 }
166
167 public function onApiOpenSearchSuggest( &$results ) {
168 return $this->container->run(
169 'ApiOpenSearchSuggest',
170 [ &$results ]
171 );
172 }
173
174 public function onApiOptions( $apiModule, $user, $changes, $resetKinds ) {
175 return $this->container->run(
176 'ApiOptions',
177 [ $apiModule, $user, $changes, $resetKinds ]
178 );
179 }
180
181 public function onApiParseMakeOutputPage( $module, $output ) {
182 return $this->container->run(
183 'ApiParseMakeOutputPage',
184 [ $module, $output ]
185 );
186 }
187
188 public function onAPIQueryAfterExecute( $module ) {
189 return $this->container->run(
190 'APIQueryAfterExecute',
191 [ $module ]
192 );
193 }
194
195 public function onApiQueryBaseAfterQuery( $module, $result, &$hookData ) {
196 return $this->container->run(
197 'ApiQueryBaseAfterQuery',
198 [ $module, $result, &$hookData ]
199 );
200 }
201
202 public function onApiQueryBaseBeforeQuery( $module, &$tables, &$fields,
203 &$conds, &$query_options, &$join_conds, &$hookData
204 ) {
205 return $this->container->run(
206 'ApiQueryBaseBeforeQuery',
207 [ $module, &$tables, &$fields, &$conds, &$query_options,
208 &$join_conds, &$hookData ]
209 );
210 }
211
212 public function onApiQueryBaseProcessRow( $module, $row, &$data, &$hookData ) {
213 return $this->container->run(
214 'ApiQueryBaseProcessRow',
215 [ $module, $row, &$data, &$hookData ]
216 );
217 }
218
219 public function onAPIQueryGeneratorAfterExecute( $module, $resultPageSet ) {
220 return $this->container->run(
221 'APIQueryGeneratorAfterExecute',
222 [ $module, $resultPageSet ]
223 );
224 }
225
226 public function onAPIQuerySiteInfoGeneralInfo( $module, &$results ) {
227 return $this->container->run(
228 'APIQuerySiteInfoGeneralInfo',
229 [ $module, &$results ]
230 );
231 }
232
233 public function onAPIQuerySiteInfoStatisticsInfo( &$results ) {
234 return $this->container->run(
235 'APIQuerySiteInfoStatisticsInfo',
236 [ &$results ]
237 );
238 }
239
240 public function onApiQueryTokensRegisterTypes( &$salts ) {
241 return $this->container->run(
242 'ApiQueryTokensRegisterTypes',
243 [ &$salts ]
244 );
245 }
246
247 public function onApiQueryWatchlistExtractOutputData( $module, $watchedItem,
248 $recentChangeInfo, &$vals
249 ) {
250 return $this->container->run(
251 'ApiQueryWatchlistExtractOutputData',
252 [ $module, $watchedItem, $recentChangeInfo, &$vals ]
253 );
254 }
255
257 $module, $params, &$options
258 ) {
259 return $this->container->run(
260 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions',
261 [ $module, $params, &$options ]
262 );
263 }
264
265 public function onApiQuery__moduleManager( $moduleManager ) {
266 return $this->container->run(
267 'ApiQuery::moduleManager',
268 [ $moduleManager ]
269 );
270 }
271
272 public function onApiRsdServiceApis( &$apis ) {
273 return $this->container->run(
274 'ApiRsdServiceApis',
275 [ &$apis ]
276 );
277 }
278
279 public function onApiValidatePassword( $module, &$r ) {
280 return $this->container->run(
281 'ApiValidatePassword',
282 [ $module, &$r ]
283 );
284 }
285
286 public function onChangeAuthenticationDataAudit( $req, $status ) {
287 return $this->container->run(
288 'ChangeAuthenticationDataAudit',
289 [ $req, $status ]
290 );
291 }
292
293 public function onEditFormPreloadText( &$text, $title ) {
294 return $this->container->run(
295 'EditFormPreloadText',
296 [ &$text, $title ]
297 );
298 }
299
300 public function onFileUndeleteComplete( $title, $fileVersions, $user, $reason ) {
301 return $this->container->run(
302 'FileUndeleteComplete',
303 [ $title, $fileVersions, $user, $reason ]
304 );
305 }
306
307 public function onGetLinkColours( $pagemap, &$classes, $title ) {
308 return $this->container->run(
309 'GetLinkColours',
310 [ $pagemap, &$classes, $title ]
311 );
312 }
313
314 public function onImportSources( &$importSources ) {
315 return $this->container->run(
316 'ImportSources',
317 [ &$importSources ]
318 );
319 }
320
321 public function onLanguageLinks( $title, &$links, &$linkFlags ) {
322 return $this->container->run(
323 'LanguageLinks',
324 [ $title, &$links, &$linkFlags ]
325 );
326 }
327
328 public function onOutputPageBeforeHTML( $out, &$text ) {
329 return $this->container->run(
330 'OutputPageBeforeHTML',
331 [ $out, &$text ]
332 );
333 }
334
335 public function onOutputPageCheckLastModified( &$modifiedTimes, $out ) {
336 return $this->container->run(
337 'OutputPageCheckLastModified',
338 [ &$modifiedTimes, $out ]
339 );
340 }
341
342 public function onRequestHasSameOriginSecurity( $request ) {
343 return $this->container->run(
344 'RequestHasSameOriginSecurity',
345 [ $request ]
346 );
347 }
348
350 Session $session,
351 UserIdentity $user,
352 string $returnTo,
353 string $returnToQuery,
354 string $returnToAnchor,
355 &$redirectUrl
356 ) {
357 return $this->container->run(
358 'TempUserCreatedRedirect',
359 [ $session, $user, $returnTo, $returnToQuery, $returnToAnchor, &$redirectUrl ]
360 );
361 }
362
363 public function onUserLoginComplete( $user, &$inject_html, $direct ) {
364 return $this->container->run(
365 'UserLoginComplete',
366 [ $user, &$inject_html, $direct ]
367 );
368 }
369
370 public function onUserLogoutComplete( $user, &$inject_html, $oldName ) {
371 return $this->container->run(
372 'UserLogoutComplete',
373 [ $user, &$inject_html, $oldName ]
374 );
375 }
376}
array $params
The job parameters.
run()
Run the job.
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.
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.
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.
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.
__construct(HookContainer $container)
onApiMain__moduleManager( $moduleManager)
This hook is called when ApiMain has finished initializing its module manager.
onApiOpenSearchSuggest(&$results)
This hook is called when constructing the OpenSearch results.
onGetLinkColours( $pagemap, &$classes, $title)
Use this hook to modify the CSS class of an array of page links.
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.
onFileUndeleteComplete( $title, $fileVersions, $user, $reason)
This hook is called when a file is undeleted.
onApiParseMakeOutputPage( $module, $output)
This hook is called when preparing the OutputPage object for ApiParse.
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.
onApiLogFeatureUsage( $feature, array $clientInfo)
This hook is called after calling the logFeatureUsage() method of an API module.
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.
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::checkCanExecute.
onAPIHelpModifyOutput( $module, &$help, $options, &$tocData)
Use this hook to modify an API module's help output.
onApiFormatHighlight( $context, $text, $mime, $format)
Use this hook to syntax-highlight API pretty-printed output.
onApiQuery__moduleManager( $moduleManager)
This hook is called when ApiQuery has finished initializing its module manager.
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.
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.
onApiRsdServiceApis(&$apis)
Use this hook to add or remove APIs from the RSD services list.
onApiQueryWatchlistExtractOutputData( $module, $watchedItem, $recentChangeInfo, &$vals)
Use this hook to extract row data for ApiQueryWatchlist.
onAPIQuerySiteInfoGeneralInfo( $module, &$results)
Use this hook to add extra information to the site's general information.
onChangeAuthenticationDataAudit( $req, $status)
This hook is called when a user changes their password.
onUserLogoutComplete( $user, &$inject_html, $oldName)
This hook is called after a user has logged out.
onAPIGetAllowedParams( $module, &$params, $flags)
Use this hook to modify a module's parameters.
onAPIAfterExecute( $module)
This hook is called after calling the execute() method of an API module.
onAPIQuerySiteInfoStatisticsInfo(&$results)
Use this hook to add extra information to the site's statistics information.
Manages data for an authenticated session.
Definition Session.php:54
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.