mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-11-23 13:56:53 +00:00
88aa29cb72
Bug: T305813 Change-Id: Ief91d92c556244c36dfcec23f770319bd2f2c537
32 lines
979 B
PHP
32 lines
979 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, $services->getHttpRequestFactory() );
|
|
},
|
|
'CookieWarning.Decisions' => static function ( MediaWikiServices $services ) {
|
|
return new Decisions(
|
|
$services->getService( 'CookieWarning.Config' ),
|
|
$services->getService( 'GeoLocation' ),
|
|
$services->getMainWANObjectCache(),
|
|
$services->getUserOptionsLookup()
|
|
);
|
|
},
|
|
];
|