Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231981

Change subject: CSSMin: version URLs based on content, not mtime
......................................................................

CSSMin: version URLs based on content, not mtime

The content of these files is more stable than their mtimes, which change
every time we roll out a new branch. Because MD5 avalanches well[0], using
the first five hexadecimal digits is sufficient to ensure that the chance
of two successive versions colliding is improbably small (roughly one in a
million).

[0]: https://en.wikipedia.org/wiki/Avalanche_effect

Change-Id: I1bdf94c58786d2545311b238476b48217a5a60af
---
M includes/libs/CSSMin.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/81/231981/1

diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php
index f415c9b..b386a92 100644
--- a/includes/libs/CSSMin.php
+++ b/includes/libs/CSSMin.php
@@ -406,9 +406,9 @@
                        // Path to the actual file on the filesystem
                        $localFile = "{$local}/{$file}";
                        if ( file_exists( $localFile ) ) {
-                               // Add version parameter as a time-stamp in ISO 
8601 format,
-                               // using Z for the timezone, meaning GMT
-                               $url .= '?' . gmdate( 'Y-m-d\TH:i:s\Z', round( 
filemtime( $localFile ), -2 ) );
+                               // Add version parameter as the first five hex 
digits
+                               // of the MD5 hash of the file's contents.
+                               $url .= '?' . substr( md5_file( $localFile ), 
0, 5 );
                                if ( $embed ) {
                                        $data = self::encodeImageAsDataURI( 
$localFile );
                                        if ( $data !== false ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/231981
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bdf94c58786d2545311b238476b48217a5a60af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to