r50833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50832‎ | r50833 | r50834 >
Date:20:07, 20 May 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Re-adding ApiMain::requestWriteMode() (removed in r48901) for backwards compatibility: this way extensions can call requestWriteMode() AND define function isWriteMode() { return true; } without causing fatal errors
Modified paths:
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -191,6 +191,12 @@
192192 }
193193
194194 /**
 195+ * Only kept for backwards compatibility
 196+ * @deprecated Use isWriteMode() instead
 197+ */
 198+ public function requestWriteMode() {}
 199+
 200+ /**
195201 * Set how long the response should be cached.
196202 */
197203 public function setCacheMaxAge($maxage) {
@@ -709,4 +715,4 @@
710716 public function __toString() {
711717 return "{$this->getCodeString()}: {$this->getMessage()}";
712718 }
713 -}
\ No newline at end of file
 719+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r50834Backport r50833 to 1.15 (fixes potential extension breakage)catrope20:10, 20 May 2009
r59948Restored the function of ApiMain::requestWriteMode(), as per the suggestion o...tstarling06:49, 11 December 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r48901Add a few FIXMEs. Inadequate i18n.siebrand22:22, 26 March 2009

Comments

#Comment by Bryan (talk | contribs)   20:19, 20 May 2009
#Comment by Bryan (talk | contribs)   20:23, 20 May 2009

I don't think that it is good to have ApiMain::requestWriteMode a no-op. It essentially creates a backdoor by allowing old extensions that require write api to work regardless.

The advantage of failing with fatal error is that old extension is immediately noticed. Alternative is to have requestWriteMode simply always disallowing access, but the current way of continuing without checking whether write mode is enabled is not good.

#Comment by Catrope (talk | contribs)   21:47, 20 May 2009

Yeah, it should probably just do the checks it always did. Having it fail isn't ideal, though, since we want extensions to work without modifications under both old and new versions of the API.

Status & tagging log