X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FMediaWiki.php;h=3b463ae4bd6d5334e977f686069423ad04364398;hb=db00239568969a41148cfdec0a77436f73fe802d;hp=431397fb40e15de7ff07d21696453788f85c774a;hpb=8ad81cbb7538d837c0e2b5ce337b71f2d07f02a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 431397fb40..3b463ae4bd 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -393,7 +393,11 @@ class MediaWiki { if ( $action instanceof Action ) { # Let Squid cache things if we can purge them. if ( $this->config->get( 'UseSquid' ) && - in_array( $request->getFullRequestURL(), $requestTitle->getSquidURLs() ) + in_array( + // Use PROTO_INTERNAL because that's what getSquidURLs() uses + wfExpandUrl( $request->getRequestURL(), PROTO_INTERNAL ), + $requestTitle->getSquidURLs() + ) ) { $output->setSquidMaxage( $this->config->get( 'SquidMaxage' ) ); } @@ -485,6 +489,19 @@ class MediaWiki { $action = $this->getAction(); $wgTitle = $title; + $trxProfiler = Profiler::instance()->getTransactionProfiler(); + + // Aside from rollback, master queries should not happen on GET requests. + // Periodic or "in passing" updates on GET should use the job queue. + if ( !$request->wasPosted() + && in_array( $action, array( 'view', 'edit', 'history' ) ) + ) { + $trxProfiler->setExpectation( 'masterConns', 0, __METHOD__ ); + $trxProfiler->setExpectation( 'writes', 0, __METHOD__ ); + } else { + $trxProfiler->setExpectation( 'maxAffected', 500, __METHOD__ ); + } + // If the user has forceHTTPS set to true, or if the user // is in a group requiring HTTPS, or if they have the HTTPS // preference set, redirect them to HTTPS. @@ -571,6 +588,10 @@ class MediaWiki { * Ends this task peacefully */ public function restInPeace() { + // Ignore things like master queries/connections on GET requests + // as long as they are in deferred updates (which catch errors). + Profiler::instance()->getTransactionProfiler()->resetExpectations(); + // Do any deferred jobs DeferredUpdates::doUpdates( 'commit' );