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,27 +211,25 @@ |
212 | 212 | # this breaks strtotime(). |
213 | 213 | $clientHeader = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] ); |
214 | 214 | |
215 | | - wfSuppressWarnings(); // E_STRICT system time bitching |
216 | | - $clientHeaderTime = strtotime( $clientHeader ); |
217 | | - wfRestoreWarnings(); |
218 | | - if ( !$clientHeaderTime ) { |
| 215 | + $clientHeaderTime = @strtotime( $clientHeader ); // E_STRICT system time bitching |
| 216 | + if( !$clientHeaderTime ) { |
219 | 217 | wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" ); |
220 | 218 | return false; |
221 | 219 | } |
222 | 220 | $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime ); |
223 | 221 | |
| 222 | + /* |
224 | 223 | wfDebug( __METHOD__ . ": client sent If-Modified-Since: " . |
225 | 224 | wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false ); |
226 | 225 | wfDebug( __METHOD__ . ": effective Last-Modified: " . |
227 | 226 | 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 |
234 | 233 | # Give a 304 response code and disable body output |
235 | | - wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false ); |
236 | 234 | $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" ); |
237 | 235 | $this->sendCacheControl(); |
238 | 236 | $this->disable(); |
— | — | @@ -739,10 +737,10 @@ |
740 | 738 | global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest; |
741 | 739 | |
742 | 740 | $response = $wgRequest->response(); |
743 | | - if ($wgUseETag && $this->mETag) |
| 741 | + if( $wgUseETag && $this->mETag ) { |
744 | 742 | $response->header("ETag: $this->mETag"); |
745 | | - |
746 | | - # don't serve compressed data to clients who can't handle it |
| 743 | + } |
| 744 | + # Don't serve compressed data to clients who can't handle it |
747 | 745 | # maintain different caches for logged-in users and non-logged in ones |
748 | 746 | $response->header( 'Vary: Accept-Encoding, Cookie' ); |
749 | 747 | |
— | — | @@ -750,10 +748,10 @@ |
751 | 749 | $response->header( $this->getXVO() ); |
752 | 750 | |
753 | 751 | if( !$this->uncacheableBecauseRequestVars() && $this->mEnableClientCache ) { |
754 | | - if( $wgUseSquid && session_id() == '' && |
755 | | - ! $this->isPrintable() && $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies() ) |
| 752 | + if( $wgUseSquid && session_id() == '' && !$this->isPrintable() && |
| 753 | + $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies() ) |
756 | 754 | { |
757 | | - if ( $wgUseESI ) { |
| 755 | + if( $wgUseESI ) { |
758 | 756 | # We'll purge the proxy cache explicitly, but require end user agents |
759 | 757 | # to revalidate against the proxy on each visit. |
760 | 758 | # Surrogate-Control controls our Squid, Cache-Control downstream caches |
— | — | @@ -779,7 +777,7 @@ |
780 | 778 | $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
781 | 779 | $response->header( "Cache-Control: private, must-revalidate, max-age=0" ); |
782 | 780 | } |
783 | | - if($this->mLastModified) { |
| 781 | + if( $this->mLastModified ) { |
784 | 782 | $response->header( "Last-Modified: {$this->mLastModified}" ); |
785 | 783 | } |
786 | 784 | } else { |
— | — | @@ -971,7 +969,6 @@ |
972 | 970 | */ |
973 | 971 | public static function setEncodings() { |
974 | 972 | global $wgInputEncoding, $wgOutputEncoding; |
975 | | - global $wgUser, $wgContLang; |
976 | 973 | |
977 | 974 | $wgInputEncoding = strtolower( $wgInputEncoding ); |
978 | 975 | |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -109,9 +109,8 @@ |
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( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) |
| 113 | + if( !is_null($ret) && $wgContLang->hasVariants() && $ret->getArticleID() == 0 ) |
114 | 114 | $wgContLang->findVariantLink( $title, $ret ); |
115 | | - |
116 | 115 | } |
117 | 116 | if( ( $oldid = $wgRequest->getInt( 'oldid' ) ) |
118 | 117 | && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { |
— | — | @@ -240,7 +239,8 @@ |
241 | 240 | } |
242 | 241 | } |
243 | 242 | wfProfileOut( __METHOD__ ); |
244 | | - return true; |
| 243 | + $this->restInPeace(); |
| 244 | + exit; |
245 | 245 | } |
246 | 246 | } |
247 | 247 | /* No match to special cases */ |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | function doUpdates( &$updates ) { |
374 | 374 | wfProfileIn( __METHOD__ ); |
375 | 375 | /* No need to get master connections in case of empty updates array */ |
376 | | - if (!$updates) { |
| 376 | + if( !$updates ) { |
377 | 377 | wfProfileOut( __METHOD__ ); |
378 | 378 | return; |
379 | 379 | } |
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 ); |