/** The singleton instance
*/
- private static $instance;
-
- /** True if the fileinfo extension has been loaded
- */
- private static $extensionLoaded = false;
+ private static $instance = null;
/** Initializes the MimeMagic object. This is called by MimeMagic::singleton().
*
* --- load mime.types ---
*/
- global $wgMimeTypeFile, $IP, $wgLoadFileinfoExtension;
+ global $wgMimeTypeFile, $IP;
$types = MM_WELL_KNOWN_MIME_TYPES;
$wgMimeTypeFile = "$IP/$wgMimeTypeFile";
}
- if ( $wgLoadFileinfoExtension && !self::$extensionLoaded ) {
- self::$extensionLoaded = true;
- wfDl( 'fileinfo' );
- }
-
if ( $wgMimeTypeFile ) {
if ( is_file( $wgMimeTypeFile ) and is_readable( $wgMimeTypeFile ) ) {
wfDebug( __METHOD__ . ": loading mime types from $wgMimeTypeFile\n" );
* Get an instance of this class
* @return MimeMagic
*/
- public static function &singleton() {
+ public static function singleton() {
if ( self::$instance === null ) {
self::$instance = new MimeMagic;
}
// trust the file extension
$mime = $this->guessTypesForExtension( $ext );
}
- }
- elseif ( $mime === 'application/x-opc+zip' ) {
+ } elseif ( $mime === 'application/x-opc+zip' ) {
if ( $this->isMatchingExtension( $ext, $mime ) ) {
// A known file extension for an OPC file,
// find the proper mime type for that file extension