Use dedicated cookie for skipping CDN cache after initiating DB changes
[lhc/web/wiklou.git] / includes / MediaWiki.php
index 19a0df7..c00be95 100644 (file)
@@ -267,7 +267,7 @@ class MediaWiki {
                                                $this->action = null;
                                                $title = $target;
                                                $output->addJsConfigVars( array(
-                                                       'wgInternalRedirectTargetUrl' => $target->getFullURL(),
+                                                       'wgInternalRedirectTargetUrl' => $target->getFullURL( $query ),
                                                ) );
                                                $output->addModules( 'mediawiki.action.view.redirect' );
                                        }
@@ -548,13 +548,13 @@ class MediaWiki {
                                if ( $limit > 0 && $time > $limit ) {
                                        throw new DBTransactionError(
                                                $db,
-                                               wfMessage( 'transaction-duration-limit-exceeded', $time, $limit )->plain()
+                                               wfMessage( 'transaction-duration-limit-exceeded', $time, $limit )->text()
                                        );
                                }
                        } );
                } );
                // Commit all changes
-               $factory->commitMasterChanges();
+               $factory->commitMasterChanges( __METHOD__ );
                // Record ChronologyProtector positions
                $factory->shutdown();
                wfDebug( __METHOD__ . ': all transactions committed' );
@@ -567,7 +567,9 @@ class MediaWiki {
                $request = $context->getRequest();
                if ( $request->wasPosted() && $factory->hasOrMadeRecentMasterChanges() ) {
                        $expires = time() + $config->get( 'DataCenterUpdateStickTTL' );
-                       $request->response()->setCookie( 'UseDC', 'master', $expires, array( 'prefix' => '' ) );
+                       $options = array( 'prefix' => '' );
+                       $request->response()->setCookie( 'UseDC', 'master', $expires, $options );
+                       $request->response()->setCookie( 'UseCDNCache', 'false', $expires, $options );
                }
 
                // Avoid letting a few seconds of slave lag cause a month of stale data
@@ -741,7 +743,7 @@ class MediaWiki {
         */
        public function restInPeace( $mode = 'fast' ) {
                // Assure deferred updates are not in the main transaction
-               wfGetLBFactory()->commitMasterChanges();
+               wfGetLBFactory()->commitMasterChanges( __METHOD__ );
 
                // Ignore things like master queries/connections on GET requests
                // as long as they are in deferred updates (which catch errors).
@@ -764,7 +766,7 @@ class MediaWiki {
 
                // Commit and close up!
                $factory = wfGetLBFactory();
-               $factory->commitMasterChanges();
+               $factory->commitMasterChanges( __METHOD__ );
                $factory->shutdown( LBFactory::SHUTDOWN_NO_CHRONPROT );
 
                wfDebug( "Request ended normally\n" );