Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
167 / 167 |
|
100.00% |
42 / 42 |
CRAP | |
100.00% |
1 / 1 |
ApiHookRunner | |
100.00% |
167 / 167 |
|
100.00% |
42 / 42 |
42 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
onAPIAfterExecute | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiCheckCanExecute | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiDeprecationHelp | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiFeedContributions__feedItem | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiFormatHighlight | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIGetAllowedParams | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIGetDescriptionMessages | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIGetParamDescriptionMessages | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIHelpModifyOutput | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiMain__moduleManager | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiMain__onException | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiMakeParserOptions | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiMaxLagInfo | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
onApiOpenSearchSuggest | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiOptions | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiParseMakeOutputPage | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIQueryAfterExecute | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryBaseAfterQuery | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryBaseBeforeQuery | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryBaseProcessRow | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIQueryGeneratorAfterExecute | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIQuerySiteInfoGeneralInfo | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onAPIQuerySiteInfoStatisticsInfo | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryTokensRegisterTypes | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryWatchlistExtractOutputData | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiQuery__moduleManager | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiRsdServiceApis | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onApiValidatePassword | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onChangeAuthenticationDataAudit | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onEditFormPreloadText | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onFileUndeleteComplete | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onGetLinkColours | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onImportSources | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onLanguageLinks | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onOutputPageBeforeHTML | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onOutputPageCheckLastModified | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onRequestHasSameOriginSecurity | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onTempUserCreatedRedirect | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onUserLoginComplete | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onUserLogoutComplete | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Api; |
4 | |
5 | use MediaWiki\HookContainer\HookContainer; |
6 | use MediaWiki\Session\Session; |
7 | use MediaWiki\User\UserIdentity; |
8 | |
9 | /** |
10 | * This class provides an implementation of the hook interfaces used |
11 | * by the core Action API, forwarding hook calls to HookContainer for |
12 | * dispatch to extensions. |
13 | * |
14 | * To get an instance, use ApiBase::getHookRunner(). |
15 | */ |
16 | class ApiHookRunner implements |
17 | Hook\APIAfterExecuteHook, |
18 | Hook\ApiCheckCanExecuteHook, |
19 | Hook\ApiDeprecationHelpHook, |
20 | Hook\ApiFeedContributions__feedItemHook, |
21 | Hook\ApiFormatHighlightHook, |
22 | Hook\APIGetAllowedParamsHook, |
23 | Hook\APIGetDescriptionMessagesHook, |
24 | Hook\APIGetParamDescriptionMessagesHook, |
25 | Hook\APIHelpModifyOutputHook, |
26 | Hook\ApiMain__moduleManagerHook, |
27 | Hook\ApiMain__onExceptionHook, |
28 | Hook\ApiMakeParserOptionsHook, |
29 | Hook\ApiMaxLagInfoHook, |
30 | Hook\ApiOpenSearchSuggestHook, |
31 | Hook\ApiOptionsHook, |
32 | Hook\ApiParseMakeOutputPageHook, |
33 | Hook\APIQueryAfterExecuteHook, |
34 | Hook\ApiQueryBaseAfterQueryHook, |
35 | Hook\ApiQueryBaseBeforeQueryHook, |
36 | Hook\ApiQueryBaseProcessRowHook, |
37 | Hook\APIQueryGeneratorAfterExecuteHook, |
38 | Hook\APIQuerySiteInfoGeneralInfoHook, |
39 | Hook\APIQuerySiteInfoStatisticsInfoHook, |
40 | Hook\ApiQueryTokensRegisterTypesHook, |
41 | Hook\ApiQueryWatchlistExtractOutputDataHook, |
42 | Hook\ApiQueryWatchlistPrepareWatchedItemQueryServiceOptionsHook, |
43 | Hook\ApiQuery__moduleManagerHook, |
44 | Hook\ApiRsdServiceApisHook, |
45 | Hook\ApiValidatePasswordHook, |
46 | Hook\RequestHasSameOriginSecurityHook, |
47 | \MediaWiki\Hook\EditFormPreloadTextHook, |
48 | \MediaWiki\Hook\FileUndeleteCompleteHook, |
49 | \MediaWiki\Hook\GetLinkColoursHook, |
50 | \MediaWiki\Hook\ImportSourcesHook, |
51 | \MediaWiki\Output\Hook\LanguageLinksHook, |
52 | \MediaWiki\Output\Hook\OutputPageBeforeHTMLHook, |
53 | \MediaWiki\Output\Hook\OutputPageCheckLastModifiedHook, |
54 | \MediaWiki\Hook\TempUserCreatedRedirectHook, |
55 | \MediaWiki\Hook\UserLoginCompleteHook, |
56 | \MediaWiki\Hook\UserLogoutCompleteHook, |
57 | \MediaWiki\SpecialPage\Hook\ChangeAuthenticationDataAuditHook |
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 | |
248 | public function onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions( |
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 | |
341 | public function onTempUserCreatedRedirect( |
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 | } |