/** * @return \OC\Files\Type\Detection */ static public function getMimetypeDetector() { if (!self::$mimetypeDetector) { self::$mimetypeDetector = new \OC\Files\Type\Detection(); self::$mimetypeDetector->registerTypeArray(include 'mimetypes.list.php'); } return self::$mimetypeDetector; }
/** * @return \OC\Files\Type\Detection */ public static function getMimetypeDetector() { if (!self::$mimetypeDetector) { $dist = file_get_contents(OC::$configDir . '/mimetypemapping.dist.json'); $mimetypemapping = get_object_vars(json_decode($dist)); //Check if need to load custom mappings if (file_exists(OC::$configDir . '/mimetypemapping.json')) { $custom = file_get_contents(OC::$configDir . '/mimetypemapping.json'); $custom_mapping = get_object_vars(json_decode($custom)); $mimetypemapping = array_merge($mimetypemapping, $custom_mapping); } self::$mimetypeDetector = new \OC\Files\Type\Detection(); self::$mimetypeDetector->registerTypeArray($mimetypemapping); } return self::$mimetypeDetector; }