Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -165,7 +165,7 @@ |
166 | 166 | * |
167 | 167 | * @return bool True iff cache-ok headers was sent. |
168 | 168 | */ |
169 | | - function checkLastModified( $timestamp ) { |
| 169 | + function checkLastModified ( $timestamp ) { |
170 | 170 | global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest; |
171 | 171 | |
172 | 172 | if ( !$timestamp || $timestamp == '19700101000000' ) { |
— | — | @@ -199,8 +199,8 @@ |
200 | 200 | |
201 | 201 | # Make debug info |
202 | 202 | $info = ''; |
203 | | - foreach( $modifiedTimes as $name => $value ) { |
204 | | - if( $info !== '' ) { |
| 203 | + foreach ( $modifiedTimes as $name => $value ) { |
| 204 | + if ( $info !== '' ) { |
205 | 205 | $info .= ', '; |
206 | 206 | } |
207 | 207 | $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value ); |
— | — | @@ -211,25 +211,27 @@ |
212 | 212 | # this breaks strtotime(). |
213 | 213 | $clientHeader = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] ); |
214 | 214 | |
215 | | - $clientHeaderTime = @strtotime( $clientHeader ); // E_STRICT system time bitching |
216 | | - if( !$clientHeaderTime ) { |
| 215 | + wfSuppressWarnings(); // E_STRICT system time bitching |
| 216 | + $clientHeaderTime = strtotime( $clientHeader ); |
| 217 | + wfRestoreWarnings(); |
| 218 | + if ( !$clientHeaderTime ) { |
217 | 219 | wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" ); |
218 | 220 | return false; |
219 | 221 | } |
220 | 222 | $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime ); |
221 | 223 | |
222 | | - /* |
223 | 224 | wfDebug( __METHOD__ . ": client sent If-Modified-Since: " . |
224 | 225 | wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false ); |
225 | 226 | wfDebug( __METHOD__ . ": effective Last-Modified: " . |
226 | 227 | wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", false ); |
227 | | - */ |
228 | 228 | if( $clientHeaderTime < $maxModified ) { |
229 | 229 | wfDebug( __METHOD__ . ": STALE, $info\n", false ); |
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | |
| 233 | + # Not modified |
233 | 234 | # Give a 304 response code and disable body output |
| 235 | + wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false ); |
234 | 236 | $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" ); |
235 | 237 | $this->sendCacheControl(); |
236 | 238 | $this->disable(); |
— | — | @@ -737,10 +739,10 @@ |
738 | 740 | global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest; |
739 | 741 | |
740 | 742 | $response = $wgRequest->response(); |
741 | | - if( $wgUseETag && $this->mETag ) { |
| 743 | + if ($wgUseETag && $this->mETag) |
742 | 744 | $response->header("ETag: $this->mETag"); |
743 | | - } |
744 | | - # Don't serve compressed data to clients who can't handle it |
| 745 | + |
| 746 | + # don't serve compressed data to clients who can't handle it |
745 | 747 | # maintain different caches for logged-in users and non-logged in ones |
746 | 748 | $response->header( 'Vary: Accept-Encoding, Cookie' ); |
747 | 749 | |
— | — | @@ -748,10 +750,10 @@ |
749 | 751 | $response->header( $this->getXVO() ); |
750 | 752 | |
751 | 753 | if( !$this->uncacheableBecauseRequestVars() && $this->mEnableClientCache ) { |
752 | | - if( $wgUseSquid && session_id() == '' && !$this->isPrintable() && |
753 | | - $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies() ) |
| 754 | + if( $wgUseSquid && session_id() == '' && |
| 755 | + ! $this->isPrintable() && $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies() ) |
754 | 756 | { |
755 | | - if( $wgUseESI ) { |
| 757 | + if ( $wgUseESI ) { |
756 | 758 | # We'll purge the proxy cache explicitly, but require end user agents |
757 | 759 | # to revalidate against the proxy on each visit. |
758 | 760 | # Surrogate-Control controls our Squid, Cache-Control downstream caches |
— | — | @@ -777,7 +779,7 @@ |
778 | 780 | $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
779 | 781 | $response->header( "Cache-Control: private, must-revalidate, max-age=0" ); |
780 | 782 | } |
781 | | - if( $this->mLastModified ) { |
| 783 | + if($this->mLastModified) { |
782 | 784 | $response->header( "Last-Modified: {$this->mLastModified}" ); |
783 | 785 | } |
784 | 786 | } else { |
— | — | @@ -969,6 +971,7 @@ |
970 | 972 | */ |
971 | 973 | public static function setEncodings() { |
972 | 974 | global $wgInputEncoding, $wgOutputEncoding; |
| 975 | + global $wgUser, $wgContLang; |
973 | 976 | |
974 | 977 | $wgInputEncoding = strtolower( $wgInputEncoding ); |
975 | 978 | |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -109,8 +109,9 @@ |
110 | 110 | $ret = Title::newFromURL( $title ); |
111 | 111 | // check variant links so that interwiki links don't have to worry |
112 | 112 | // about the possible different language variants |
113 | | - if( !is_null($ret) && $wgContLang->hasVariants() && $ret->getArticleID() == 0 ) |
| 113 | + if( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) |
114 | 114 | $wgContLang->findVariantLink( $title, $ret ); |
| 115 | + |
115 | 116 | } |
116 | 117 | if( ( $oldid = $wgRequest->getInt( 'oldid' ) ) |
117 | 118 | && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { |
— | — | @@ -234,8 +235,7 @@ |
235 | 236 | $article->viewUpdates(); |
236 | 237 | } |
237 | 238 | wfProfileOut( __METHOD__ ); |
238 | | - $this->restInPeace(); |
239 | | - exit; |
| 239 | + return true; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | /* No match to special cases */ |
— | — | @@ -368,7 +368,7 @@ |
369 | 369 | function doUpdates( &$updates ) { |
370 | 370 | wfProfileIn( __METHOD__ ); |
371 | 371 | /* No need to get master connections in case of empty updates array */ |
372 | | - if( !$updates ) { |
| 372 | + if (!$updates) { |
373 | 373 | wfProfileOut( __METHOD__ ); |
374 | 374 | return; |
375 | 375 | } |
Index: trunk/phase3/index.php |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo ); |
91 | 91 | |
92 | 92 | $mediaWiki->initialize( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest ); |
93 | | -$mediaWiki->finalCleanup( $wgDeferredUpdateList, $wgOut ); |
| 93 | +$mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgOut ); |
94 | 94 | |
95 | 95 | # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup |
96 | 96 | $mediaWiki->doUpdates( $wgPostCommitUpdateList ); |