/**
* Plugins for media file type handling.
* Each entry in the array maps a MIME type to a class name
+ *
+ * Core media handlers are listed in MediaHandlerFactory,
+ * and extensions should use extension.json.
*/
-$wgMediaHandlers = [
- 'image/jpeg' => 'JpegHandler',
- 'image/png' => 'PNGHandler',
- 'image/gif' => 'GIFHandler',
- 'image/tiff' => 'TiffHandler',
- 'image/webp' => 'WebPHandler',
- 'image/x-ms-bmp' => 'BmpHandler',
- 'image/x-bmp' => 'BmpHandler',
- 'image/x-xcf' => 'XCFHandler',
- 'image/svg+xml' => 'SvgHandler', // official
- 'image/svg' => 'SvgHandler', // compat
- 'image/vnd.djvu' => 'DjVuHandler', // official
- 'image/x.djvu' => 'DjVuHandler', // compat
- 'image/x-djvu' => 'DjVuHandler', // compat
-];
+$wgMediaHandlers = [];
/**
* Plugins for page content model handling.
class MediaHandlerFactory {
/**
+ * Default, MediaWiki core media handlers
+ *
+ * @var array
+ */
+ private static $coreHandlers = [
+ 'image/jpeg' => JpegHandler::class,
+ 'image/png' => PNGHandler::class,
+ 'image/gif' => GIFHandler::class,
+ 'image/tiff' => TiffHandler::class,
+ 'image/webp' => WebPHandler::class,
+ 'image/x-ms-bmp' => BmpHandler::class,
+ 'image/x-bmp' => BmpHandler::class,
+ 'image/x-xcf' => XCFHandler::class,
+ 'image/svg+xml' => SvgHandler::class, // official
+ 'image/svg' => SvgHandler::class, // compat
+ 'image/vnd.djvu' => DjVuHandler::class, // official
+ 'image/x.djvu' => DjVuHandler::class, // compat
+ 'image/x-djvu' => DjVuHandler::class, // compat
+ ];
+
+ /**
+ * Instance cache of MediaHandler objects by mimetype
+ *
* @var MediaHandler[]
*/
private $handlers;
protected function getHandlerClass( $type ) {
global $wgMediaHandlers;
- if ( isset( $wgMediaHandlers[$type] ) ) {
- return $wgMediaHandlers[$type];
+
+ $registry = $wgMediaHandlers + self::$coreHandlers;
+ if ( isset( $registry[$type] ) ) {
+ return $registry[$type];
} else {
return false;
}