]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove last occurences of OC_Helper::getMimeType()
authorMorris Jobke <hey@morrisjobke.de>
Thu, 26 Nov 2015 09:18:32 +0000 (10:18 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 26 Nov 2015 09:18:32 +0000 (10:18 +0100)
* ref #4774

lib/private/files/objectstore/objectstorestorage.php
lib/private/installer.php
lib/public/files.php
tests/lib/helper.php

index e108d7662d4b590eaef291287de06e06b6e164c5..5ec05a3529eeebdc108a5ca4620bba77a6453dc7 100644 (file)
@@ -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);
index 86968a7c18968293dd44d7576f98bfdce228514e..021e496392f2c25983533f659e58089be3afacc1 100644 (file)
@@ -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)));
                }
index c1dcffcbefb3ffabb935e4c31329826c210acb47..e3582375f38d7e32ff03e53497d8e6219bb8b62a 100644 (file)
@@ -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);
        }
 
        /**
index ca3e0e46d82051a50657a6224511480d8f0a00aa..af550df309cf76b5cb05de031e2e1073ac56808d 100644 (file)
@@ -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';