diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-09-08 12:17:57 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-09-22 16:43:28 +0200 |
commit | 63b2bc136aa9b101b424cab89f31c772a9a4baea (patch) | |
tree | b74e301f8ef826377c7eaa05ad17101f837eedd6 /lib | |
parent | a8e8a9dfb968d7e93b01404b9a12c1e48d8431a4 (diff) | |
download | nextcloud-server-63b2bc136aa9b101b424cab89f31c772a9a4baea.tar.gz nextcloud-server-63b2bc136aa9b101b424cab89f31c772a9a4baea.zip |
Move mimetype files into /resources/config/
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/type/detection.php | 35 | ||||
-rw-r--r-- | lib/private/server.php | 4 |
2 files changed, 25 insertions, 14 deletions
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index 3dc3975fb2a..0c647ab44c6 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -49,15 +49,22 @@ class Detection implements IMimeTypeDetector { private $urlGenerator; /** @var string */ - private $configDir; + private $customConfigDir; + + /** @var string */ + private $defaultConfigDir; /** * @param IURLGenerator $urlGenerator - * @param string $configDir + * @param string $customConfigDir + * @param string $defaultConfigDir */ - public function __construct(IURLGenerator $urlGenerator, $configDir) { + public function __construct(IURLGenerator $urlGenerator, + $customConfigDir, + $defaultConfigDir) { $this->urlGenerator = $urlGenerator; - $this->configDir = $configDir; + $this->customConfigDir = $customConfigDir; + $this->defaultConfigDir = $defaultConfigDir; } /** @@ -71,7 +78,9 @@ class Detection implements IMimeTypeDetector { * @param string $mimetype * @param string|null $secureMimeType */ - public function registerType($extension, $mimetype, $secureMimeType = null) { + public function registerType($extension, + $mimetype, + $secureMimeType = null) { $this->mimetypes[$extension] = array($mimetype, $secureMimeType); $this->secureMimeTypes[$mimetype] = $secureMimeType ?: $mimetype; } @@ -102,10 +111,10 @@ class Detection implements IMimeTypeDetector { return; } - $this->mimeTypeAlias = json_decode(file_get_contents($this->configDir . '/mimetypealiases.dist.json'), true); + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); - if (file_exists($this->configDir . '/mimetypealiases.json')) { - $custom = json_decode(file_get_contents($this->configDir . '/mimetypealiases.json'), true); + if (file_exists($this->customConfigDir . '/mimetypealiases.json')) { + $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypealiases.json'), true); $this->mimeTypeAlias = array_merge($this->mimeTypeAlias, $custom); } } @@ -126,15 +135,15 @@ class Detection implements IMimeTypeDetector { return; } - $mimetypemapping = json_decode(file_get_contents($this->configDir . '/mimetypemapping.dist.json'), true); + $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); //Check if need to load custom mappings - if (file_exists($this->configDir . '/mimetypemapping.json')) { - $custom = json_decode(file_get_contents($this->configDir . '/mimetypemapping.json'), true); - $mimetypemapping = array_merge($mimetypemapping, $custom); + if (file_exists($this->customConfigDir . '/mimetypemapping.json')) { + $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypemapping.json'), true); + $mimetypeMapping = array_merge($mimetypeMapping, $custom); } - $this->registerTypeArray($mimetypemapping); + $this->registerTypeArray($mimetypeMapping); } /** diff --git a/lib/private/server.php b/lib/private/server.php index d5f4f532c1c..9f99ead849b 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -470,7 +470,9 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('MimeTypeDetector', function(Server $c) { return new \OC\Files\Type\Detection( $c->getURLGenerator(), - \OC::$configDir); + \OC::$SERVERROOT . '/config/', + \OC::$SERVERROOT . '/resources/config/' + ); }); $this->registerService('MimeTypeLoader', function(Server $c) { return new \OC\Files\Type\Loader( |