r60871 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60870‎ | r60871 | r60872 >
Date:19:14, 9 January 2010
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
Revert 60864: "Use wfClientAcceptsGzip() in wfGzipHandler." Causes PHP Notice: Undefined index: HTTP_ACCEPT_ENCODING in GlobalFunctions.php on line 1175
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/OutputHandler.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1168,15 +1168,17 @@
11691169 */
11701170 function wfClientAcceptsGzip() {
11711171 global $wgUseGzip;
1172 - # FIXME: we may want to blacklist some broken browsers
1173 - $m = array();
1174 - if( preg_match(
1175 - '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
1176 - $_SERVER['HTTP_ACCEPT_ENCODING'],
1177 - $m ) ) {
1178 - if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) return false;
1179 - wfDebug( " accepts gzip\n" );
1180 - return true;
 1172+ if( $wgUseGzip ) {
 1173+ # FIXME: we may want to blacklist some broken browsers
 1174+ $m = array();
 1175+ if( preg_match(
 1176+ '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
 1177+ $_SERVER['HTTP_ACCEPT_ENCODING'],
 1178+ $m ) ) {
 1179+ if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) return false;
 1180+ wfDebug( " accepts gzip\n" );
 1181+ return true;
 1182+ }
11811183 }
11821184 return false;
11831185 }
Index: trunk/phase3/includes/OutputHandler.php
@@ -74,9 +74,12 @@
7575 return $s;
7676 }
7777
78 - if( wfClientAcceptsGzip() ) {
79 - header( 'Content-Encoding: gzip' );
80 - $s = gzencode( $s, 6 );
 78+ if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
 79+ $tokens = preg_split( '/[,; ]/', $_SERVER['HTTP_ACCEPT_ENCODING'] );
 80+ if ( in_array( 'gzip', $tokens ) ) {
 81+ header( 'Content-Encoding: gzip' );
 82+ $s = gzencode( $s, 6 );
 83+ }
8184 }
8285
8386 // Set vary header if it hasn't been set already
Index: trunk/phase3/RELEASE-NOTES
@@ -19,7 +19,6 @@
2020 it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
2121
2222 === Configuration changes in 1.16 ===
23 -
2423 * (bug 18222) $wgMinimalPasswordLength default is now 1
2524 * $wgSessionHandler can be used to configure session.save_handler
2625 * $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
@@ -82,12 +81,12 @@
8382 similarly to the category namespace.
8483 * $wgEnableSorbs renamed to $wgDnsBlacklistUrls ($wgEnableSorbs kept for
8584 backward compatibility)
86 -* $wgUploadNavigationUrl now also affects images inline images that do not
87 - exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to
 85+* $wgUploadNavigationUrl now also affects images inline images that do not
 86+ exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to
8887 it as appropriate.
8988 * If $wgLocaltimezone is null, use the server's timezone as the default for
9089 signatures. This was always the behaviour documented in DefaultSettings.php
91 - but has not been the actual behaviour for some time: instead, UTC was used
 90+ but has not been the actual behaviour for some time: instead, UTC was used
9291 by default.
9392
9493
@@ -660,10 +659,10 @@
661660 only displayed to the users that have "editinterface" right
662661 * (bug 21740) Attempting to protect a page that doesn't exist (salting) returns
663662 "unknown error"
664 -* (bug 18762) both redirects and links get fixed one after another if
 663+* (bug 18762) both redirects and links get fixed one after another if
665664 redirects-only switch is not present
666665 * (bug 20159) thumbnails rerendered if older that $wgThumbnailEpoch
667 -* Fixed a bug which in some situations causes the job queue to grow forever,
 666+* Fixed a bug which in some situations causes the job queue to grow forever,
668667 due to an infinite loop of job requeues.
669668 * (bug 21523) File that can have multiple pages (djvu, pdf, ...) no longer have
670669 the page selector when they have only one page
@@ -694,8 +693,6 @@
695694 * (bug 2658) Don't attempt to set the TZ environment variable.
696695 * (bug 9794) User rights log entries for foreign user now links to the foreign
697696 user's page if possible
698 -* (bug 22034) Use wfClientAcceptsGzip() in wfGzipHandler instead of
699 - reimplementing it.
700697
701698 == API changes in 1.16 ==
702699
@@ -766,8 +763,8 @@
767764 * (bug 21441) meta=userinfo&uiprop=options no longer returns default options
768765 for logged-in users under certain circumstances
769766 * (bug 21945) Add chomp control in YAML
770 -* Expand the thumburl to an absolute url to make it consistent with url and
771 - descriptionurl
 767+* Expand the thumburl to an absolute url to make it consistent with url and
 768+ descriptionurl
772769 * (bug 20233) ApiLogin::execute() doesn't handle LoginForm :: RESET_PASS
773770
774771 === Languages updated in 1.16 ===

Comments

#Comment by Locos epraix (talk | contribs)   01:35, 10 January 2010

¿?

Status & tagging log