diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-07-08 15:49:53 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-07-08 17:16:12 +0200 |
commit | 895d29adf18fcf6a334839aead46bdb4bd9dbbec (patch) | |
tree | c6ce62e526bf130b5b53806daa63b941cb4de72d /lib | |
parent | 35fba1ef9f562a10a6b796e47024305218043bfc (diff) | |
download | nextcloud-server-895d29adf18fcf6a334839aead46bdb4bd9dbbec.tar.gz nextcloud-server-895d29adf18fcf6a334839aead46bdb4bd9dbbec.zip |
Move mimetypemapping.json to mimetypemapping.dist.json
This allows users to create their own mapping file to extend our current
mappings. This makes sure that custom mappings are not lost on OC
upgrades.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/helper.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php index abe1e42ecb0..09b319e90c8 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -424,8 +424,15 @@ class OC_Helper { */ static public function getMimetypeDetector() { if (!self::$mimetypeDetector) { - $file = file_get_contents(OC::$SERVERROOT . '/config/mimetypemapping.json'); - $mimetypemapping = get_object_vars(json_decode($file)); + $dist = file_get_contents(OC::$SERVERROOT . '/config/mimetypemapping.dist.json'); + $mimetypemapping = get_object_vars(json_decode($dist)); + + //Check if need to load custom mappings + if (file_exists(OC::$SERVERROOT . '/config/mimetypemapping.json')) { + $custom = file_get_contents(OC::$SERVERROOT . '/config/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); |