$reqArr['wpMinoredit'] = '';
if($params['recreate'])
$reqArr['wpRecreate'] = '';
- if(!is_null($params['captchaid']))
- $reqArr['wpCaptchaId'] = $params['captchaid'];
- if(!is_null($params['captchaword']))
- $reqArr['wpCaptchaWord'] = $params['captchaword'];
if(!is_null($params['section']))
{
$section = intval($params['section']);
$ep->importFormData($req);
# Run hooks
- # We need to fake $wgRequest for some of them
+ # Handle CAPTCHA parameters
global $wgRequest;
- $oldRequest = $wgRequest;
- $wgRequest = $req;
+ if(isset($params['captchaid']))
+ $wgRequest->data['wpCaptchaId'] = $params['captchaid'];
+ if(isset($params['captchaword']))
+ $wgRequest->data['wpCaptchaWord'] = $params['captchaword'];
$r = array();
if(!wfRunHooks('APIEditBeforeSave', array(&$ep, $ep->textbox1, &$r)))
{
else
$this->dieUsageMsg(array('hookaborted'));
}
- $wgRequest = $oldRequest;
# Do the actual save
$oldRevId = $articleObj->getRevIdFetched();
# but that breaks API mode detection through is_null($wgTitle)
global $wgTitle;
$wgTitle = null;
+ # Fake $wgRequest for some hooks inside EditPage
+ # FIXME: This interface SUCKS
+ $oldRequest = $wgRequest;
+ $wgRequest = $req;
+
$retval = $ep->internalAttemptSave($result, $wgUser->isAllowed('bot') && $params['bot']);
+ $wgRequest = $oldRequest;
switch($retval)
{
case EditPage::AS_HOOK_ERROR: