Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | use MediaWiki\MediaWikiServices; |
4 | use MediaWiki\Registration\ExtensionRegistry; |
5 | |
6 | // PHPUnit doesn't understand code coverage for code outside of classes/functions, |
7 | // like service wiring files. This *is* tested though, see |
8 | // tests/phpunit/integration/ServiceWiringTest.php |
9 | // @codeCoverageIgnoreStart |
10 | |
11 | /* |
12 | * CheckUser provides a service for this, but |
13 | * we define our own nullable here to make CheckUser a soft dependency |
14 | */ |
15 | return [ |
16 | 'NukeIPLookup' => static function ( |
17 | MediaWikiServices $services |
18 | ) { |
19 | // Allow IP lookups if CheckUser is present and temp user config is known and enabled |
20 | if ( !ExtensionRegistry::getInstance()->isLoaded( 'CheckUser' ) ) { |
21 | return null; |
22 | } |
23 | $tempUserConfig = $services->getTempUserConfig(); |
24 | $tempUserIsKnown = $tempUserConfig->isKnown(); |
25 | $tempUserIsEnabled = $tempUserConfig->isEnabled(); |
26 | if ( !$tempUserIsKnown || !$tempUserIsEnabled ) { |
27 | return null; |
28 | } |
29 | return $services->get( 'CheckUserTemporaryAccountsByIPLookup' ); |
30 | } |
31 | ]; |
32 | |
33 | // @codeCoverageIgnoreEnd |