jenkins-bot has submitted this change and it was merged.

Change subject: Account for $wgSquidMaxage in OutputPage::checkLastModified().
......................................................................


Account for $wgSquidMaxage in OutputPage::checkLastModified().

* This deals with the fact that seldom edited pages can end up cached
  with very stale resource (JS/CSS) references since the response to
  IMS GET requests will be 304 Not Modified if page_touched is ancient.
  When squid revalidates its stale cache it will keep getting 304s and
  renewing the TTL on the stale cache.

Bug: 44570
Change-Id: I3889f300012aeabd37e228653279ad19b296e4ae
---
M includes/OutputPage.php
1 file changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 8bf6443..9f911d5 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -687,7 +687,7 @@
         * @return Boolean: true iff cache-ok headers was sent.
         */
        public function checkLastModified( $timestamp ) {
-               global $wgCachePages, $wgCacheEpoch;
+               global $wgCachePages, $wgCacheEpoch, $wgUseSquid, 
$wgSquidMaxage;
 
                if ( !$timestamp || $timestamp == '19700101000000' ) {
                        wfDebug( __METHOD__ . ": CACHE DISABLED, NO 
TIMESTAMP\n" );
@@ -704,10 +704,14 @@
 
                $timestamp = wfTimestamp( TS_MW, $timestamp );
                $modifiedTimes = array(
-                       'page' => $timestamp,
-                       'user' => $this->getUser()->getTouched(),
-                       'epoch' => $wgCacheEpoch
+                       'page'   => $timestamp,
+                       'user'   => $this->getUser()->getTouched(),
+                       'epoch'  => $wgCacheEpoch
                );
+               if ( $wgUseSquid ) {
+                       // bug 44570: the core page itself may not change, but 
resources might
+                       $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - 
$wgSquidMaxage );
+               }
                wfRunHooks( 'OutputPageCheckLastModified', array( 
&$modifiedTimes ) );
 
                $maxModified = max( $modifiedTimes );

-- 
To view, visit https://gerrit.wikimedia.org/r/58415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3889f300012aeabd37e228653279ad19b296e4ae
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to