dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resourceloader: Optimise getMimeType() for common case
[lhc/web/wiklou.git]
/
includes
/
libs
/
CSSMin.php
diff --git
a/includes/libs/CSSMin.php
b/includes/libs/CSSMin.php
index
b1cece8
..
bba07e2
100644
(file)
--- a/
includes/libs/CSSMin.php
+++ b/
includes/libs/CSSMin.php
@@
-176,6
+176,12
@@
class CSSMin {
* @return bool|string
*/
public static function getMimeType( $file ) {
* @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
$realpath = realpath( $file );
if (
$realpath
@@
-186,12
+192,6
@@
class CSSMin {
return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
}
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;
}
return false;
}