Krinkle has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/344741 )
Change subject: resourceloader: Optimise getMimeType() for common case ...................................................................... resourceloader: Optimise getMimeType() for common case About 0.74% of load.php is spent in CSSMin::getMimeType/finfo_file. We don't apply this to user-generated content of external urls, only local files in version control. And in terms of correctness, we don't support misleading file names, so it's not a problem that a foo.png containing XML/SVG content would get the wrong mime-type when base64 embedding it in CSS. Change-Id: I17686467c897984117671098e94db8732446dc75 --- M includes/libs/CSSMin.php 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/41/344741/1 diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index b1cece8..bba07e2 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -176,6 +176,12 @@ * @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 @@ -184,12 +190,6 @@ && defined( 'FILEINFO_MIME_TYPE' ) ) { 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; -- To view, visit https://gerrit.wikimedia.org/r/344741 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I17686467c897984117671098e94db8732446dc75 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits