From: Ori Livneh Date: Mon, 23 Sep 2013 21:46:41 +0000 (-0700) Subject: Rename lessc->embeddedImages to lessc->embeddedFiles X-Git-Tag: 1.31.0-rc.0~18683^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=565b0fae817d6089eb7d14b132da845bb85a839c;p=lhc%2Fweb%2Fwiklou.git Rename lessc->embeddedImages to lessc->embeddedFiles 'embeddedImages' is a custom property we set on lessc compiler instances to track the set of files that were embedded in the generated source as data URIs. This is so done so we know to regenerate the CSS if the source file for an embedded asset changes. (If my pull request[1] is merged, we won't have to use a custom property at all.) I realized that the property name should be 'embeddedFiles' rather than 'embeddedImages', because it's not just images that can be usefully embedded in CSS, but fonts as well. [1]: https://github.com/leafo/lessphp/pull/472 Change-Id: Ief3afaa23e4532f4a536e0dfef943d4fa20db80d --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7a1eb22818..46d1fd42f8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3355,7 +3355,7 @@ $wgResourceLoaderLESSFunctions = array( $file = realpath( $base . '/' . $url ); $data = CSSMin::encodeImageAsDataURI( $file ); - $less->embeddedImages[ $file ] = filemtime( $file ); + $less->embeddedFiles[ $file ] = filemtime( $file ); return 'url(' . $data . ')'; }, ); diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index ead81cc2a3..3b81b11948 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -772,9 +772,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $result['files'] = array( $fileName => self::safeFilemtime( $fileName ) ); $result['updated'] = time(); } - // Tie cache expiry to the names and mtimes of image files that were - // embedded in the generated CSS source. - $result['files'] += $compiler->embeddedImages; + // Tie cache expiry to the names and mtimes of files that were embedded + // as data URIs in the generated CSS source. + $result['files'] += $compiler->embeddedFiles; $this->localFileRefs += array_keys( $result['files'] ); $cache->set( $key, $result, $expire ); return $result['compiled']; diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 226d91c224..1119cdbb08 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -470,10 +470,10 @@ abstract class ResourceLoaderModule { foreach ( $wgResourceLoaderLESSFunctions as $name => $func ) { $less->registerFunction( $name, $func ); } - // To ensure embedded images are refreshed when their source files - // change, track the names and modification times of image files that - // were embedded in the generated CSS source. - $less->embeddedImages = array(); + // To ensure embedded resources are refreshed when their source files + // change, track the names and modification times of any files that + // were embedded as data URIs in the generated CSS source. + $less->embeddedFiles = array(); return $less; }