}
/**
- * A query module to list all external URLs found on a given set of pages.
+ * A module that allows for editing and creating pages.
*
+ * Currently, this wraps around the EditPage class in an ugly way,
+ * EditPage.php should be rewritten to provide a cleaner interface
* @ingroup API
*/
class ApiEditPage extends ApiBase {
$reqArr['wpEdittime'] = wfTimestamp(TS_MW, $params['basetimestamp']);
else
$reqArr['wpEdittime'] = $articleObj->getTimestamp();
- # Fake wpStartime
- $reqArr['wpStarttime'] = $reqArr['wpEdittime'];
+ if(!is_null($params['starttimestamp']) && $params['starttimestamp'] != '')
+ $reqArr['wpStarttime'] = wfTimestamp(TS_MW, $params['starttimestamp']);
+ else
+ # Fake wpStartime
+ $reqArr['wpStarttime'] = $reqArr['wpEdittime'];
if($params['minor'] || (!$params['notminor'] && $wgUser->getOption('minordefault')))
$reqArr['wpMinoredit'] = '';
if($params['recreate'])
# Handle CAPTCHA parameters
global $wgRequest;
if(isset($params['captchaid']))
- $wgRequest->data['wpCaptchaId'] = $params['captchaid'];
+ $wgRequest->setVal( 'wpCaptchaId', $params['captchaid'] );
if(isset($params['captchaword']))
- $wgRequest->data['wpCaptchaWord'] = $params['captchaword'];
+ $wgRequest->setVal( 'wpCaptchaWord', $params['captchaword'] );
$r = array();
if(!wfRunHooks('APIEditBeforeSave', array(&$ep, $ep->textbox1, &$r)))
{
case EditPage::AS_END:
# This usually means some kind of race condition
# or DB weirdness occurred. Throw an unknown error here.
- $this->dieUsageMsg(array('unknownerror', 'AS_END'));
+ $this->dieUsageMsg(array('unknownerror'));
case EditPage::AS_SUCCESS_NEW_ARTICLE:
$r['new'] = '';
case EditPage::AS_SUCCESS_UPDATE:
'notminor' => false,
'bot' => false,
'basetimestamp' => null,
+ 'starttimestamp' => null,
'recreate' => false,
'createonly' => false,
'nocreate' => false,
'basetimestamp' => array('Timestamp of the base revision (gotten through prop=revisions&rvprop=timestamp).',
'Used to detect edit conflicts; leave unset to ignore conflicts.'
),
+ 'starttimestamp' => array('Timestamp when you obtained the edit token.',
+ 'Used to detect edit conflicts; leave unset to ignore conflicts.'
+ ),
'recreate' => 'Override any errors about the article having been deleted in the meantime',
'createonly' => 'Don\'t edit the page if it exists already',
'nocreate' => 'Throw an error if the page doesn\'t exist',