From a4eaa896254c53e3a3761126dae461aa91f13609 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 17 May 2008 04:26:26 +0000 Subject: [PATCH] * Fix unlogged automatic user creation: run wfLBFactory()->shutdown() unconditionally in api.php. If you want to optimise it, do it in the database backend, since there's no way for the MW core to indicate to the web API that a write query has been performed. The previous code was also wrong in that it didn't commit transactions on foreign connections. * Fixed debugging code left in (mustBePosted disabled). --- api.php | 3 +++ includes/api/ApiLogin.php | 2 +- includes/api/ApiMain.php | 11 +++-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/api.php b/api.php index b856708e2a..77dc52a4fb 100644 --- a/api.php +++ b/api.php @@ -83,3 +83,6 @@ wfDoUpdates(); wfProfileOut('api.php'); wfLogProfilingData(); +// Shut down the database +wfGetLBFactory()->shutdown(); + diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 2b603b37ab..42d67a0e9f 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -223,7 +223,7 @@ class ApiLogin extends ApiBase { return wfMemcKey( 'apilogin', 'badlogin', 'ip', wfGetIP() ); } - //public function mustBePosted() { return true; } + public function mustBePosted() { return true; } public function getAllowedParams() { return array ( diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 49fe93a30d..14ad68a575 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -199,10 +199,9 @@ class ApiMain extends ApiBase { /** * Schedule a database commit + * @deprecated */ - public function scheduleCommit() { - $this->mCommit = true; - } + public function scheduleCommit() {} /** * Execute api request. Any errors will be handled if the API was called by the remote client. @@ -213,11 +212,7 @@ class ApiMain extends ApiBase { $this->executeAction(); else $this->executeActionWithErrorHandling(); - if($this->mCommit) - { - $dbw = wfGetDb(DB_MASTER); - $dbw->immediateCommit(); - } + $this->profileOut(); } -- 2.20.1