mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-11-23 22:03:41 +00:00
7e23848ac9
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption() Bug: T277600 Change-Id: I562b19ca41a7ef18be940ec398d58d6873b2555b
32 lines
922 B
PHP
32 lines
922 B
PHP
<?php
|
|
|
|
use CookieWarning\Decisions;
|
|
use CookieWarning\HttpGeoLocation;
|
|
use CookieWarning\NoopGeoLocation;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
'CookieWarning.Config' => function ( MediaWikiServices $services ) {
|
|
return $services->getService( 'ConfigFactory' )
|
|
->makeConfig( 'cookiewarning' );
|
|
},
|
|
'GeoLocation' => function ( MediaWikiServices $services ) {
|
|
$geoIPServiceURL = $services
|
|
->getService( 'CookieWarning.Config' )
|
|
->get( 'CookieWarningGeoIPServiceURL' );
|
|
|
|
if ( !is_string( $geoIPServiceURL ) || !$geoIPServiceURL ) {
|
|
return new NoopGeoLocation();
|
|
}
|
|
return new HttpGeoLocation( $geoIPServiceURL );
|
|
},
|
|
'CookieWarning.Decisions' => function ( MediaWikiServices $services ) {
|
|
return new Decisions(
|
|
$services->getService( 'CookieWarning.Config' ),
|
|
$services->getService( 'GeoLocation' ),
|
|
$services->getMainWANObjectCache(),
|
|
$services->getUserOptionsLookup()
|
|
);
|
|
},
|
|
];
|