r34951 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34950‎ | r34951 | r34952 >
Date:04:26, 17 May 2008
Author:tstarling
Status:old
Tags:
Comment:
* 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).
Modified paths:
  • /trunk/phase3/api.php (modified) (history)
  • /trunk/phase3/includes/api/ApiLogin.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiLogin.php
@@ -223,7 +223,7 @@
224224 return wfMemcKey( 'apilogin', 'badlogin', 'ip', wfGetIP() );
225225 }
226226
227 - //public function mustBePosted() { return true; }
 227+ public function mustBePosted() { return true; }
228228
229229 public function getAllowedParams() {
230230 return array (
Index: trunk/phase3/includes/api/ApiMain.php
@@ -199,10 +199,9 @@
200200
201201 /**
202202 * Schedule a database commit
 203+ * @deprecated
203204 */
204 - public function scheduleCommit() {
205 - $this->mCommit = true;
206 - }
 205+ public function scheduleCommit() {}
207206
208207 /**
209208 * Execute api request. Any errors will be handled if the API was called by the remote client.
@@ -213,11 +212,7 @@
214213 $this->executeAction();
215214 else
216215 $this->executeActionWithErrorHandling();
217 - if($this->mCommit)
218 - {
219 - $dbw = wfGetDb(DB_MASTER);
220 - $dbw->immediateCommit();
221 - }
 216+
222217 $this->profileOut();
223218 }
224219
Index: trunk/phase3/api.php
@@ -83,3 +83,6 @@
8484 wfProfileOut('api.php');
8585 wfLogProfilingData();
8686
 87+// Shut down the database
 88+wfGetLBFactory()->shutdown();
 89+

Status & tagging log