From aafe047a70383c8420e3bd7132e2f10b96e6ae5a Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 20 Jul 2012 22:38:24 +0200 Subject: [PATCH] Execute jobs on all index.php requests. The problem is that currently deferred updates are not executed after action=ajax requests or file cache hits. This means that, e.g. ViewCountUpdates are not executed after file cache hits. The code to execute jobs (both deferred updates and job queue) is now in MediaWiki::restInPeace() so that it's also executed after what is mentioned above, and the remaining code of MediaWiki::finalCleanup() is moved directly MediaWiki::main() since that function is only used in one place and it make no sense to keep a method for such little code. Change-Id: I6f511a74c59a2e3653c10bfcff9b0d15118e699f --- includes/Wiki.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 7efb082755..5f593e7e8c 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -392,23 +392,6 @@ class MediaWiki { return $article; } - /** - * Cleaning up request by doing deferred updates, DB transaction, and the output - */ - public function finalCleanup() { - wfProfileIn( __METHOD__ ); - // Now commit any transactions, so that unreported errors after - // output() don't roll back the whole DB transaction - $factory = wfGetLBFactory(); - $factory->commitMasterChanges(); - // Output everything! - $this->context->getOutput()->output(); - // Do any deferred jobs - DeferredUpdates::doUpdates( 'commit' ); - $this->doJobs(); - wfProfileOut( __METHOD__ ); - } - /** * Do a job from the job queue */ @@ -447,12 +430,23 @@ class MediaWiki { * Ends this task peacefully */ public function restInPeace() { + // Do any deferred jobs + DeferredUpdates::doUpdates( 'commit' ); + + // Execute a job from the queue + $this->doJobs(); + + // Log message usage, if $wgAdaptiveMessageCache is set to true MessageCache::logMessages(); + + // Log profiling data, e.g. in the database or UDP wfLogProfilingData(); + // Commit and close up! $factory = wfGetLBFactory(); $factory->commitMasterChanges(); $factory->shutdown(); + wfDebug( "Request ended normally\n" ); } @@ -599,7 +593,13 @@ class MediaWiki { } $this->performRequest(); - $this->finalCleanup(); + + // Now commit any transactions, so that unreported errors after + // output() don't roll back the whole DB transaction + wfGetLBFactory()->commitMasterChanges(); + + // Output everything! + $this->context->getOutput()->output(); wfProfileOut( __METHOD__ ); } -- 2.20.1