On Thu, 03 Mar 2005 13:07:10 -0800, Pieter Konink pk@pieterkonink.com wrote:
http://bugzilla.wikipedia.org/show_bug.cgi?id=63
The bug is marked fixed, but the last post merely says it was fixed in the CVS ("... set cookie with logged in and log out timestamp, then check them when checking If-Modified-Since.").
I was just wondering if someone who is using CVS could fill me in on the code modified, or give me some pointers for how to do it myself. Thank you!
I felt like playing with CVS, so I reckon this looks like the edits in question. Don't come crying to me if they don't work, but if you really don't like the idea of upgrading, but really really want this fix, take a look at this diff:
Index: includes/OutputPage.php =================================================================== @@ -110,11 +110,11 @@ # this breaks strtotime(). $modsince = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] ); $ismodsince = wfTimestamp( TS_MW, strtotime( $modsince ) ); wfDebug( "-- client send If-Modified-Since: " . $modsince . "\n", false ); wfDebug( "-- we might send Last-Modified : $lastmod\n", false ); - if( ($ismodsince >= $timestamp ) and $wgUser->validateCache( $ismodsince ) ) { + if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) ) { # Make sure you're in a place you can leave when you call us! header( "HTTP/1.0 304 Not Modified" ); $this->mLastModified = $lastmod; $this->sendCacheControl(); wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
Index: includes/User.php =================================================================== @@ -151,11 +151,11 @@ static $n=0; $n++; $fname = 'User::loadDefaults' . $n; wfProfileIn( $fname ); - global $wgContLang, $wgIP; + global $wgContLang, $wgIP, $wgDBname; global $wgNamespacesToBeSearchedDefault;
$this->mId = 0; $this->mNewtalk = -1; $this->mName = $wgIP; @@ -173,13 +173,20 @@ $this->mOptions['searchNs'.$nsnum] = $val; } unset( $this->mSkin ); $this->mDataLoaded = false; $this->mBlockedby = -1; # Unset - $this->mTouched = '0'; # Allow any pages to be cached $this->setToken(); # Random $this->mHash = false; + + if ( isset( $_COOKIE[$wgDBname.'LoggedOut'] ) ) { + $this->mTouched = wfTimestamp( TS_MW, $_COOKIE[$wgDBname.'LoggedOut'] ); + } + else { + $this->mTouched = '0'; # Allow any pages to be cached + } + wfProfileOut( $fname ); }
/** * Used to load user options from a language. @@ -912,10 +919,13 @@
$_SESSION['wsUserID'] = 0;
setcookie( $wgDBname.'UserID', '', time() - 3600, $wgCookiePath, $wgCookieDomain ); setcookie( $wgDBname.'Token', '', time() - 3600, $wgCookiePath, $wgCookieDomain ); + + # Remember when user logged out, to prevent seeing cached pages + setcookie( $wgDBname.'LoggedOut', wfTimestampNow(), time() + 86400, $wgCookiePath, $wgCookieDomain ); }
/** * Save object settings into database */