},
'MediaHandlerFactory' => function( MediaWikiServices $services ) {
- return new MediaHandlerFactory();
+ return new MediaHandlerFactory(
+ $services->getMainConfig()->get( 'MediaHandlers' )
+ );
},
'LinkCache' => function( MediaWikiServices $services ) {
'image/x-djvu' => DjVuHandler::class, // compat
];
+ /**
+ * @var array
+ */
+ private $registry;
+
/**
* Instance cache of MediaHandler objects by mimetype
*
*/
private $handlers;
- protected function getHandlerClass( $type ) {
- global $wgMediaHandlers;
+ public function __construct( array $registry ) {
+ $this->registry = $registry + self::$coreHandlers;
+ }
- $registry = $wgMediaHandlers + self::$coreHandlers;
- if ( isset( $registry[$type] ) ) {
- return $registry[$type];
+ protected function getHandlerClass( $type ) {
+ if ( isset( $this->registry[$type] ) ) {
+ return $this->registry[$type];
} else {
return false;
}
'application/ogg' => MockOggHandler::class,
];
+ public function __construct() {
+ // override parent
+ }
+
protected function getHandlerClass( $type ) {
if ( isset( self::$overrides[$type] ) ) {
return self::$overrides[$type];