mediawiki-extensions-Cookie.../includes/ServiceWiring.php
libraryupgrader 66ba87913d build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I11808cfb01de67037062e03f0db4268418e65b49
2021-05-04 03:05:13 +00:00

32 lines
943 B
PHP

<?php
use CookieWarning\Decisions;
use CookieWarning\HttpGeoLocation;
use CookieWarning\NoopGeoLocation;
use MediaWiki\MediaWikiServices;
return [
'CookieWarning.Config' => static function ( MediaWikiServices $services ) {
return $services->getService( 'ConfigFactory' )
->makeConfig( 'cookiewarning' );
},
'GeoLocation' => static function ( MediaWikiServices $services ) {
$geoIPServiceURL = $services
->getService( 'CookieWarning.Config' )
->get( 'CookieWarningGeoIPServiceURL' );
if ( !is_string( $geoIPServiceURL ) || !$geoIPServiceURL ) {
return new NoopGeoLocation();
}
return new HttpGeoLocation( $geoIPServiceURL );
},
'CookieWarning.Decisions' => static function ( MediaWikiServices $services ) {
return new Decisions(
$services->getService( 'CookieWarning.Config' ),
$services->getService( 'GeoLocation' ),
$services->getMainWANObjectCache(),
$services->getUserOptionsLookup()
);
},
];