r44801 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44800‎ | r44801 | r44802 >
Date:09:21, 19 December 2008
Author:aaron
Status:reverted (Comments)
Tags:
Comment:
Tweaks from profiling
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -165,7 +165,7 @@
166166 *
167167 * @return bool True iff cache-ok headers was sent.
168168 */
169 - function checkLastModified ( $timestamp ) {
 169+ function checkLastModified( $timestamp ) {
170170 global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest;
171171
172172 if ( !$timestamp || $timestamp == '19700101000000' ) {
@@ -199,8 +199,8 @@
200200
201201 # Make debug info
202202 $info = '';
203 - foreach ( $modifiedTimes as $name => $value ) {
204 - if ( $info !== '' ) {
 203+ foreach( $modifiedTimes as $name => $value ) {
 204+ if( $info !== '' ) {
205205 $info .= ', ';
206206 }
207207 $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
@@ -211,27 +211,25 @@
212212 # this breaks strtotime().
213213 $clientHeader = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] );
214214
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 ) {
219217 wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
220218 return false;
221219 }
222220 $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
223221
 222+ /*
224223 wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
225224 wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false );
226225 wfDebug( __METHOD__ . ": effective Last-Modified: " .
227226 wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", false );
 227+ */
228228 if( $clientHeaderTime < $maxModified ) {
229229 wfDebug( __METHOD__ . ": STALE, $info\n", false );
230230 return false;
231231 }
232232
233 - # Not modified
234233 # Give a 304 response code and disable body output
235 - wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false );
236234 $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" );
237235 $this->sendCacheControl();
238236 $this->disable();
@@ -739,10 +737,10 @@
740738 global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest;
741739
742740 $response = $wgRequest->response();
743 - if ($wgUseETag && $this->mETag)
 741+ if( $wgUseETag && $this->mETag ) {
744742 $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
747745 # maintain different caches for logged-in users and non-logged in ones
748746 $response->header( 'Vary: Accept-Encoding, Cookie' );
749747
@@ -750,10 +748,10 @@
751749 $response->header( $this->getXVO() );
752750
753751 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() )
756754 {
757 - if ( $wgUseESI ) {
 755+ if( $wgUseESI ) {
758756 # We'll purge the proxy cache explicitly, but require end user agents
759757 # to revalidate against the proxy on each visit.
760758 # Surrogate-Control controls our Squid, Cache-Control downstream caches
@@ -779,7 +777,7 @@
780778 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
781779 $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
782780 }
783 - if($this->mLastModified) {
 781+ if( $this->mLastModified ) {
784782 $response->header( "Last-Modified: {$this->mLastModified}" );
785783 }
786784 } else {
@@ -971,7 +969,6 @@
972970 */
973971 public static function setEncodings() {
974972 global $wgInputEncoding, $wgOutputEncoding;
975 - global $wgUser, $wgContLang;
976973
977974 $wgInputEncoding = strtolower( $wgInputEncoding );
978975
Index: trunk/phase3/includes/Wiki.php
@@ -109,9 +109,8 @@
110110 $ret = Title::newFromURL( $title );
111111 // check variant links so that interwiki links don't have to worry
112112 // 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 )
114114 $wgContLang->findVariantLink( $title, $ret );
115 -
116115 }
117116 if( ( $oldid = $wgRequest->getInt( 'oldid' ) )
118117 && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) {
@@ -240,7 +239,8 @@
241240 }
242241 }
243242 wfProfileOut( __METHOD__ );
244 - return true;
 243+ $this->restInPeace();
 244+ exit;
245245 }
246246 }
247247 /* No match to special cases */
@@ -372,7 +372,7 @@
373373 function doUpdates( &$updates ) {
374374 wfProfileIn( __METHOD__ );
375375 /* No need to get master connections in case of empty updates array */
376 - if (!$updates) {
 376+ if( !$updates ) {
377377 wfProfileOut( __METHOD__ );
378378 return;
379379 }
Index: trunk/phase3/index.php
@@ -89,7 +89,7 @@
9090 $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
9191
9292 $mediaWiki->initialize( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
93 -$mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgOut );
 93+$mediaWiki->finalCleanup( $wgDeferredUpdateList, $wgOut );
9494
9595 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
9696 $mediaWiki->doUpdates( $wgPostCommitUpdateList );

Follow-up revisions

RevisionCommit summaryAuthorDate
r44963Revert r44801 "Tweaks from profiling"...brion19:39, 23 December 2008
r44970Add FileCache exit back from r44801aaron20:56, 23 December 2008
r44980Revert r44970 "Add FileCache exit back from r44801"...brion21:50, 23 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   19:39, 23 December 2008

Reverted in r44963 -- changes are unclear at best, there's no information about what's based on profiling or what performance changes it might make, and it seems to lose valuable debugging log info.

Status & tagging log