summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-11-26 10:18:32 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-11-26 10:18:32 +0100
commit9318606fafce10740c30be3662514d5a7a139ce5 (patch)
treed3c127c197028ed8b7143fed0c614ac7176661fe
parentdd18ea611bd0e66969df22aedddc98cddbba4984 (diff)
downloadnextcloud-server-9318606fafce10740c30be3662514d5a7a139ce5.tar.gz
nextcloud-server-9318606fafce10740c30be3662514d5a7a139ce5.zip
Remove last occurences of OC_Helper::getMimeType()
* ref #4774
-rw-r--r--lib/private/files/objectstore/objectstorestorage.php2
-rw-r--r--lib/private/installer.php2
-rw-r--r--lib/public/files.php2
-rw-r--r--tests/lib/helper.php23
4 files changed, 3 insertions, 26 deletions
diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index e108d7662d4..5ec05a3529e 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -370,7 +370,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
$stat['size'] = filesize($tmpFile);
$stat['mtime'] = $mTime;
$stat['storage_mtime'] = $mTime;
- $stat['mimetype'] = \OC_Helper::getMimeType($tmpFile);
+ $stat['mimetype'] = \OC::$server->getMimeTypeDetector()->detect($tmpFile);
$stat['etag'] = $this->getETag($path);
$fileId = $this->getCache()->put($path, $stat);
diff --git a/lib/private/installer.php b/lib/private/installer.php
index 86968a7c189..021e496392f 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -278,7 +278,7 @@ class OC_Installer{
}
//detect the archive type
- $mime=OC_Helper::getMimeType($path);
+ $mime = \OC::$server->getMimeTypeDetector()->detect($path);
if ($mime !=='application/zip' && $mime !== 'application/x-gzip' && $mime !== 'application/x-bzip2') {
throw new \Exception($l->t("Archives of type %s are not supported", array($mime)));
}
diff --git a/lib/public/files.php b/lib/public/files.php
index c1dcffcbefb..e3582375f38 100644
--- a/lib/public/files.php
+++ b/lib/public/files.php
@@ -60,7 +60,7 @@ class Files {
* @since 5.0.0
*/
static function getMimeType( $path ) {
- return(\OC_Helper::getMimeType( $path ));
+ return \OC::$server->getMimeTypeDetector()->detect($path);
}
/**
diff --git a/tests/lib/helper.php b/tests/lib/helper.php
index ca3e0e46d82..af550df309c 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/helper.php
@@ -71,29 +71,6 @@ class Test_Helper extends \Test\TestCase {
];
}
- function testGetMimeType() {
- $dir=OC::$SERVERROOT.'/tests/data';
- $result = OC_Helper::getMimeType($dir."/");
- $expected = 'httpd/unix-directory';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/data.tar.gz");
- $expected = 'application/x-gzip';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/data.zip");
- $expected = 'application/zip';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/desktopapp.svg");
- $expected = 'image/svg+xml';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/desktopapp.png");
- $expected = 'image/png';
- $this->assertEquals($result, $expected);
- }
-
function testGetSecureMimeType() {
$dir=OC::$SERVERROOT.'/tests/data';