2018-07-18 09:50:46 +00:00
|
|
|
<?php
|
|
|
|
|
2018-07-19 10:48:17 +00:00
|
|
|
use CookieWarning\Decisions;
|
2018-11-04 15:15:42 +00:00
|
|
|
use CookieWarning\HttpGeoLocation;
|
|
|
|
use CookieWarning\NoopGeoLocation;
|
2018-07-18 09:50:46 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
return [
|
2021-05-03 07:13:11 +00:00
|
|
|
'CookieWarning.Config' => static function ( MediaWikiServices $services ) {
|
2018-07-18 09:50:46 +00:00
|
|
|
return $services->getService( 'ConfigFactory' )
|
|
|
|
->makeConfig( 'cookiewarning' );
|
|
|
|
},
|
2021-05-03 07:13:11 +00:00
|
|
|
'GeoLocation' => static function ( MediaWikiServices $services ) {
|
2018-11-04 15:15:42 +00:00
|
|
|
$geoIPServiceURL = $services
|
|
|
|
->getService( 'CookieWarning.Config' )
|
|
|
|
->get( 'CookieWarningGeoIPServiceURL' );
|
|
|
|
|
|
|
|
if ( !is_string( $geoIPServiceURL ) || !$geoIPServiceURL ) {
|
|
|
|
return new NoopGeoLocation();
|
|
|
|
}
|
2022-12-11 13:18:17 +00:00
|
|
|
return new HttpGeoLocation( $geoIPServiceURL, $services->getHttpRequestFactory() );
|
2018-07-18 09:50:46 +00:00
|
|
|
},
|
2021-05-03 07:13:11 +00:00
|
|
|
'CookieWarning.Decisions' => static function ( MediaWikiServices $services ) {
|
2021-03-30 18:24:32 +00:00
|
|
|
return new Decisions(
|
|
|
|
$services->getService( 'CookieWarning.Config' ),
|
|
|
|
$services->getService( 'GeoLocation' ),
|
|
|
|
$services->getMainWANObjectCache(),
|
|
|
|
$services->getUserOptionsLookup()
|
|
|
|
);
|
2018-07-18 09:50:46 +00:00
|
|
|
},
|
|
|
|
];
|