summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-13 08:31:18 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-13 08:31:18 +0200
commit1006ec56ceb2c7c5bc14a5401d46767cb4b72e6c (patch)
treeadc87050a1f4f43eb2d41009e0d2416992d07e8b /lib/private/helper.php
parent52e9c94e08d69854697fc1a0b8df185fd57ae9f8 (diff)
parent8cac236135c4b07983e824c1ff0b9235aa0a0762 (diff)
downloadnextcloud-server-1006ec56ceb2c7c5bc14a5401d46767cb4b72e6c.tar.gz
nextcloud-server-1006ec56ceb2c7c5bc14a5401d46767cb4b72e6c.zip
Merge pull request #17481 from rullzer/mimetype-list
Move mimetypes.list.php to config/mimetypemapping.dist.json
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 825166b58a1..e825009f687 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -434,8 +434,18 @@ class OC_Helper {
*/
static public 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(include 'mimetypes.list.php');
+ self::$mimetypeDetector->registerTypeArray($mimetypemapping);
}
return self::$mimetypeDetector;
}