r72362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72361‎ | r72362 | r72363 >
Date:09:44, 4 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/CSSMin.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CSSMin.php
@@ -44,6 +44,7 @@
4545 * @return string Remapped CSS data
4646 */
4747 public static function remap( $source, $path ) {
 48+ global $wgUseDataURLs;
4849 $pattern = '/((?<embed>\s*\/\*\s*\@embed\s*\*\/)(?<rule>[^\;\}]*))?url\([\'"]?(?<file>[^\?\)\:]*)\??[^\)]*[\'"]?\)(?<extra>[^;]*)[\;]?/';
4950 $offset = 0;
5051 while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) {
@@ -57,7 +58,7 @@
5859 // Add version parameter as a time-stamp in ISO 8601 format, using Z for the timezone, meaning GMT
5960 $url = "{$file}?" . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) );
6061 // Detect when URLs were preceeded with embed tags, and also verify file size is below the limit
61 - if ( $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) {
 62+ if ( $wgUseDataURLs && $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) {
6263 // If we ever get to PHP 5.3, we should use the Fileinfo extension instead of mime_content_type
6364 $type = mime_content_type( $file );
6465 // Strip off any trailing = symbols (makes browsers freak out)
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1641,6 +1641,12 @@
16421642 */
16431643 $wgResourceLoaderServerMaxage = 30*24*60*60; // 30 days
16441644
 1645+/**
 1646+ * Enable data URL embedding (experimental). This variable is very temporary and
 1647+ * will be removed once we get this feature stable.
 1648+ */
 1649+$wgUseDataURLs = false;
 1650+
16451651 /** @} */ # end of cache settings
16461652
16471653 /************************************************************************//**

Status & tagging log