mediawiki-extensions-Cookie.../includes/ServiceWiring.php
ZabeMath 7e23848ac9 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: I562b19ca41a7ef18be940ec398d58d6873b2555b
2021-03-30 20:31:57 +00:00

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()
);
},
];