summaryrefslogtreecommitdiffstats
path: root/lib/private/server.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-04-09 15:19:57 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2015-07-27 14:58:45 +0200
commit6db6689740a5d11dd53b2502d1eea6e9157479df (patch)
tree276787c9cca5355c5faf50de3b76294b97cca559 /lib/private/server.php
parent4edfadac96fcf267c97371e67e5feccec94b337e (diff)
downloadnextcloud-server-6db6689740a5d11dd53b2502d1eea6e9157479df.tar.gz
nextcloud-server-6db6689740a5d11dd53b2502d1eea6e9157479df.zip
Added mimetype detector
* Copied unit tests from old functions
Diffstat (limited to 'lib/private/server.php')
-rw-r--r--lib/private/server.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/server.php b/lib/private/server.php
index 53949b53df7..7aa331884b6 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -12,6 +12,7 @@
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <icewind@owncloud.com>
* @author Robin McCorkell <rmccorkell@karoshi.org.uk>
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Sander <brantje@gmail.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Thomas Tanghus <thomas@tanghus.net>
@@ -58,6 +59,7 @@ use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Tagging\TagMapper;
use OCP\IServerContainer;
+use OC\Files\Type\Detection;
/**
* Class Server
@@ -443,6 +445,13 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('MountManager', function () {
return new \OC\Files\Mount\Manager();
});
+ $this->registerService('MimeTypeDetector', function(Server $c) {
+ $mimeTypeDetector = new Detection();
+ $dist = file_get_contents(\OC::$configDir . '/mimetypemapping.dist.json');
+ $mimetypemapping = get_object_vars(json_decode($dist));
+ $mimeTypeDetector->registerTypeArray($mimetypemapping);
+ return $mimeTypeDetector;
+ });
}
/**
@@ -930,4 +939,13 @@ class Server extends SimpleContainer implements IServerContainer {
function getMountManager() {
return $this->query('MountManager');
}
+
+ /*
+ * Get the MimeTypeDetector
+ *
+ * @return \OCP\Files\IMimeTypeDetector
+ */
+ public function getMimeTypeDetector() {
+ return $this->query('MimeTypeDetector');
+ }
}