resourceloader: Optimise getMimeType() for common case
[lhc/web/wiklou.git] / includes / libs / CSSMin.php
index b1cece8..bba07e2 100644 (file)
@@ -176,6 +176,12 @@ class CSSMin {
         * @return bool|string
         */
        public static function getMimeType( $file ) {
+               // Infer the MIME-type from the file extension
+               $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
+               if ( isset( self::$mimeTypes[$ext] ) ) {
+                       return self::$mimeTypes[$ext];
+               }
+
                $realpath = realpath( $file );
                if (
                        $realpath
@@ -186,12 +192,6 @@ class CSSMin {
                        return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
                }
 
-               // Infer the MIME-type from the file extension
-               $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
-               if ( isset( self::$mimeTypes[$ext] ) ) {
-                       return self::$mimeTypes[$ext];
-               }
-
                return false;
        }