mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-12-18 08:40:51 +00:00
66ba87913d
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0 * php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0 Change-Id: I11808cfb01de67037062e03f0db4268418e65b49
32 lines
943 B
PHP
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()
|
|
);
|
|
},
|
|
];
|