Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/271452
Change subject: Vary the parser cache on $wgResponsiveImages ...................................................................... Vary the parser cache on $wgResponsiveImages The point of responsive images is to let the client select the right image variants. Unfortunately, all major browsers make the mistake of only considering one criterion -- device pixel density. Connection speed and bandwidth costs are not considered. There is thus good reason for wanting to suppress the srcset attribute based on what the server knows about the user: the value of a user-set preference, for example, or the user's device or connection profile. For MediaWiki to be able to serve srcset in some cases and suppress it in others, need the parser cache to vary on the value of $wgResponsiveImages. $wgResponsiveImages was introduced in MediaWiki 1.21 (released in 2013), and it has always been true by default. To avoid needlessly invalidating existing parser cache values, we only update the key when $wgResponsiveImages is false. Change-Id: Ifa29d8b430ba1198f73c792264e3c4fc90d23f97 --- M includes/parser/ParserOptions.php 1 file changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/52/271452/1 diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 49c6ce9..4891e0c 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -763,7 +763,7 @@ * @return string Page rendering hash */ public function optionsHash( $forOptions, $title = null ) { - global $wgRenderHashAppend; + global $wgRenderHashAppend, $wgResponsiveImages; // FIXME: Once the cache key is reorganized this argument // can be dropped. It was used when the math extension was @@ -826,6 +826,13 @@ $confstr .= '!printable=1'; } + // Responsive images are enabled by default, so only record the value + // of $wgResponsiveImages when it is false, to avoid needlessly + // invalidating parser cache entries which predate Ifa29d8b4. + if ( $wgResponsiveImages === false ) { + $confstr .= '!responsiveimages=0'; + } + if ( $this->mExtraKey != '' ) { $confstr .= $this->mExtraKey; } -- To view, visit https://gerrit.wikimedia.org/r/271452 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifa29d8b430ba1198f73c792264e3c4fc90d23f97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits