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