Add more preOutputCommit() comments
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 13 Jan 2016 17:31:39 +0000 (09:31 -0800)
committerBryanDavis <bdavis@wikimedia.org>
Sun, 17 Jan 2016 22:21:26 +0000 (22:21 +0000)
Change-Id: Ia0b4c37b391b8e5e77397d21458f9638b49ebf71

includes/MediaWiki.php

index ab02ba7..0e3a734 100644 (file)
@@ -566,8 +566,9 @@ class MediaWiki {
                DeferredUpdates::doUpdates( 'enqueue', DeferredUpdates::PRESEND );
                wfDebug( __METHOD__ . ': pre-send deferred updates completed' );
 
                DeferredUpdates::doUpdates( 'enqueue', DeferredUpdates::PRESEND );
                wfDebug( __METHOD__ . ': pre-send deferred updates completed' );
 
-               // Set a cookie to tell all CDN edge nodes to "stick" the user to the
-               // DC that handles this POST request (e.g. the "master" data center)
+               // Set a cookie to tell all CDN edge nodes to "stick" the user to the DC that handles this
+               // POST request (e.g. the "master" data center). Also have the user briefly bypass CDN so
+               // ChronologyProtector works for cacheable URLs.
                $request = $context->getRequest();
                if ( $request->wasPosted() && $factory->hasOrMadeRecentMasterChanges() ) {
                        $expires = time() + $config->get( 'DataCenterUpdateStickTTL' );
                $request = $context->getRequest();
                if ( $request->wasPosted() && $factory->hasOrMadeRecentMasterChanges() ) {
                        $expires = time() + $config->get( 'DataCenterUpdateStickTTL' );
@@ -576,7 +577,8 @@ class MediaWiki {
                        $request->response()->setCookie( 'UseCDNCache', 'false', $expires, $options );
                }
 
                        $request->response()->setCookie( 'UseCDNCache', 'false', $expires, $options );
                }
 
-               // Avoid letting a few seconds of slave lag cause a month of stale data
+               // Avoid letting a few seconds of slave lag cause a month of stale data. This logic is
+               // also intimately related to the value of $wgCdnReboundPurgeDelay.
                if ( $factory->laggedSlaveUsed() ) {
                        $maxAge = $config->get( 'CdnMaxageLagged' );
                        $context->getOutput()->lowerCdnMaxage( $maxAge );
                if ( $factory->laggedSlaveUsed() ) {
                        $maxAge = $config->get( 'CdnMaxageLagged' );
                        $context->getOutput()->lowerCdnMaxage( $maxAge );