2022-08-16 15:24:01 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-12 11:48:04 +00:00
|
|
|
use MediaWiki\Extension\Gadgets\GadgetDefinitionNamespaceRepo;
|
2022-08-16 15:24:01 +00:00
|
|
|
use MediaWiki\Extension\Gadgets\GadgetRepo;
|
2023-12-12 11:48:04 +00:00
|
|
|
use MediaWiki\Extension\Gadgets\MediaWikiGadgetsDefinitionRepo;
|
2022-08-16 15:24:01 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
return [
|
|
|
|
'GadgetsRepo' => static function ( MediaWikiServices $services ): GadgetRepo {
|
2023-12-12 11:48:04 +00:00
|
|
|
$wanCache = $services->getMainWANObjectCache();
|
|
|
|
$revisionLookup = $services->getRevisionLookup();
|
|
|
|
switch ( $services->getMainConfig()->get( 'GadgetsRepo' ) ) {
|
|
|
|
case 'definition':
|
|
|
|
return new MediaWikiGadgetsDefinitionRepo( $wanCache, $revisionLookup );
|
|
|
|
case 'json':
|
|
|
|
return new GadgetDefinitionNamespaceRepo( $wanCache, $revisionLookup );
|
|
|
|
default:
|
|
|
|
throw new InvalidArgumentException( 'Unexpected value for $wgGadgetsRepo' );
|
|
|
|
}
|
2022-08-16 15:24:01 +00:00
|
|
|
},
|
|
|
|
];
|