From: Bryan Tong Minh Date: Thu, 26 May 2011 17:11:51 +0000 (+0000) Subject: (bug 27891) Follow-up r72475: destroy the LBFactory singleton before doing any jobs... X-Git-Tag: 1.31.0-rc.0~29926 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=9045d4ec3abc634d7d2bc41bf552372fdd2f83f7;p=lhc%2Fweb%2Fwiklou.git (bug 27891) Follow-up r72475: destroy the LBFactory singleton before doing any jobs so that jobs do not access the current session while still preserving ChronologyProtector. --- diff --git a/includes/Wiki.php b/includes/Wiki.php index 86017bd346..c447b24253 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -321,8 +321,7 @@ class MediaWiki { $this->context->output->output(); // Do any deferred jobs wfDoUpdates( 'commit' ); - // Close the session so that jobs don't access the current session - session_write_close(); + $this->doJobs(); wfProfileOut( __METHOD__ ); } @@ -345,6 +344,10 @@ class MediaWiki { } else { $n = intval( $wgJobRunRate ); } + + // Close the session so that jobs don't access the current session + $this->shutdownLBFactory(); + session_write_close(); while ( $n-- && false != ( $job = Job::pop() ) ) { $output = $job->toString() . "\n"; @@ -367,11 +370,20 @@ class MediaWiki { public function restInPeace() { MessageCache::logMessages(); wfLogProfilingData(); + $this->shutdownLBFactory(); + wfDebug( "Request ended normally\n" ); + } + + /** + * Commit pending master changes, shutdown the current loadbalancer + * factory and destroys the factory instance. + */ + private function shutdownLBFactory() { // Commit and close up! - $factory = wfGetLBFactory(); + $factory = LBFactory::singleton(); $factory->commitMasterChanges(); $factory->shutdown(); - wfDebug( "Request ended normally\n" ); + LBFactory::destroyInstance(); } /**