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