mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-12-04 11:48:14 +00:00
9d05af9df8
Bug: T357642 Change-Id: I868133bca622ad2af851e874b450fe0be53017d2
29 lines
1.1 KiB
PHP
29 lines
1.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Gadgets\GadgetRepo;
|
|
use MediaWiki\Extension\Gadgets\MediaWikiGadgetsDefinitionRepo;
|
|
use MediaWiki\Extension\Gadgets\MediaWikiGadgetsJsonRepo;
|
|
use MediaWiki\Extension\Gadgets\MultiGadgetRepo;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
'GadgetsRepo' => static function ( MediaWikiServices $services ): GadgetRepo {
|
|
$wanCache = $services->getMainWANObjectCache();
|
|
$revisionLookup = $services->getRevisionLookup();
|
|
$dbProvider = $services->getConnectionProvider();
|
|
switch ( $services->getMainConfig()->get( 'GadgetsRepo' ) ) {
|
|
case 'definition':
|
|
return new MediaWikiGadgetsDefinitionRepo( $dbProvider, $wanCache, $revisionLookup );
|
|
case 'json':
|
|
return new MediaWikiGadgetsJsonRepo( $dbProvider, $wanCache, $revisionLookup );
|
|
case 'json+definition':
|
|
return new MultiGadgetRepo( [
|
|
new MediaWikiGadgetsJsonRepo( $dbProvider, $wanCache, $revisionLookup ),
|
|
new MediaWikiGadgetsDefinitionRepo( $dbProvider, $wanCache, $revisionLookup )
|
|
] );
|
|
default:
|
|
throw new InvalidArgumentException( 'Unexpected value for $wgGadgetsRepo' );
|
|
}
|
|
},
|
|
];
|