From e6b5f0f60b315bbdc32f26fa65f4d1e606b816b2 Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Sat, 4 Sep 2010 09:44:01 +0000 Subject: [PATCH] Temporarily disable data URL embedding by default until we figure out how to make this work reliably. At least Chrome and possibly Opera were having issues with data URLs. --- includes/CSSMin.php | 3 ++- includes/DefaultSettings.php | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/CSSMin.php b/includes/CSSMin.php index e088114893..76f3f98ed7 100644 --- a/includes/CSSMin.php +++ b/includes/CSSMin.php @@ -44,6 +44,7 @@ class CSSMin { * @return string Remapped CSS data */ public static function remap( $source, $path ) { + global $wgUseDataURLs; $pattern = '/((?\s*\/\*\s*\@embed\s*\*\/)(?[^\;\}]*))?url\([\'"]?(?[^\?\)\:]*)\??[^\)]*[\'"]?\)(?[^;]*)[\;]?/'; $offset = 0; while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) { @@ -57,7 +58,7 @@ class CSSMin { // Add version parameter as a time-stamp in ISO 8601 format, using Z for the timezone, meaning GMT $url = "{$file}?" . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) ); // Detect when URLs were preceeded with embed tags, and also verify file size is below the limit - if ( $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) { + if ( $wgUseDataURLs && $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) { // If we ever get to PHP 5.3, we should use the Fileinfo extension instead of mime_content_type $type = mime_content_type( $file ); // Strip off any trailing = symbols (makes browsers freak out) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index bd7d0e0593..aa7670933b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1641,6 +1641,12 @@ $wgResourceLoaderClientMaxage = 30*24*60*60; // 30 days */ $wgResourceLoaderServerMaxage = 30*24*60*60; // 30 days +/** + * Enable data URL embedding (experimental). This variable is very temporary and + * will be removed once we get this feature stable. + */ +$wgUseDataURLs = false; + /** @} */ # end of cache settings /************************************************************************//** -- 2.20.1