From: Alexandre Emsenhuber Date: Thu, 19 Jul 2012 16:35:25 +0000 (+0200) Subject: Use WebRequest instead of $_SERVER in OutputPage. X-Git-Tag: 1.31.0-rc.0~22938^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=643ba4f579a143f68027517b55c9270847337e2e;p=lhc%2Fweb%2Fwiklou.git Use WebRequest instead of $_SERVER in OutputPage. Also moved debug string generation a bit lower so that it's executed only when it will actually be used. Change-Id: Ia01e7fb1dba1f2f55c156d3ac097acf2a68dca70 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1b4bc4942b..bf70467cfd 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -647,24 +647,16 @@ class OutputPage extends ContextSource { $maxModified = max( $modifiedTimes ); $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified ); - if( empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { + $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' ); + if ( $clientHeader === false ) { wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", false ); return false; } - # Make debug info - $info = ''; - foreach ( $modifiedTimes as $name => $value ) { - if ( $info !== '' ) { - $info .= ', '; - } - $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value ); - } - # IE sends sizes after the date like this: # Wed, 20 Aug 2003 06:51:19 GMT; length=5202 # this breaks strtotime(). - $clientHeader = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] ); + $clientHeader = preg_replace( '/;.*$/', '', $clientHeader ); wfSuppressWarnings(); // E_STRICT system time bitching $clientHeaderTime = strtotime( $clientHeader ); @@ -675,6 +667,15 @@ class OutputPage extends ContextSource { } $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime ); + # Make debug info + $info = ''; + foreach ( $modifiedTimes as $name => $value ) { + if ( $info !== '' ) { + $info .= ', '; + } + $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value ); + } + wfDebug( __METHOD__ . ": client sent If-Modified-Since: " . wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false ); wfDebug( __METHOD__ . ": effective Last-Modified: " .