r41426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41425‎ | r41426 | r41427 >
Date:15:13, 30 September 2008
Author:demon
Status:old (Comments)
Tags:
Comment:
Added setVal accessor to $wgRequest->data so we don't have to access it directly. Use this in ApiEditPage.
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -136,9 +136,9 @@
137137 # Handle CAPTCHA parameters
138138 global $wgRequest;
139139 if(isset($params['captchaid']))
140 - $wgRequest->data['wpCaptchaId'] = $params['captchaid'];
 140+ $wgRequest->setVal( 'wpCaptchaId' ) = $params['captchaid'];
141141 if(isset($params['captchaword']))
142 - $wgRequest->data['wpCaptchaWord'] = $params['captchaword'];
 142+ $wgRequest->setVal( 'wpCaptchaWord' ) = $params['captchaword'];
143143 $r = array();
144144 if(!wfRunHooks('APIEditBeforeSave', array(&$ep, $ep->textbox1, &$r)))
145145 {
Index: trunk/phase3/includes/WebRequest.php
@@ -256,6 +256,18 @@
257257 return (string)$val;
258258 }
259259 }
 260+
 261+ /**
 262+ * Set an aribtrary value into our get/post data.
 263+ * @param $key string Key name to use
 264+ * @param $value mixed Value to set
 265+ * @return mixed old value if one was present, null otherwise
 266+ */
 267+ function setVal( $key, $value ) {
 268+ $ret = isset( $this->data[$key] ) ? $this->data[$key] : null;
 269+ $this->data[$key] = $value;
 270+ return $ret;
 271+ }
260272
261273 /**
262274 * Fetch an array from the input or return $default if it's not set.

Comments

#Comment by Brion VIBBER (talk | contribs)   00:59, 1 October 2008

the setVal() calls are wrong; this is fixed in followup r41428

Status & tagging log