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