}
/**
- * @addtogroup API
+ * @ingroup API
*/
class ApiUndelete extends ApiBase {
global $wgUser;
$this->getMain()->requestWriteMode();
$params = $this->extractRequestParams();
-
+
$titleObj = NULL;
if(!isset($params['title']))
$this->dieUsageMsg(array('missingparam', 'title'));
$this->dieUsageMsg(array('invalidtitle', $params['title']));
// Convert timestamps
+ if(!isset($params['timestamps']))
+ $params['timestamps'] = array();
if(!is_array($params['timestamps']))
$params['timestamps'] = array($params['timestamps']);
foreach($params['timestamps'] as $i => $ts)
if(!is_array($retval))
$this->dieUsageMsg(array('cannotundelete'));
- $this->getMain()->scheduleCommit();
+ if($retval[1])
+ wfRunHooks( 'FileUndeleteComplete',
+ array($titleObj, array(), $wgUser, $params['reason']) );
+
$info['title'] = $titleObj->getPrefixedText();
$info['revisions'] = $retval[0];
$info['fileversions'] = $retval[1];
$info['reason'] = $retval[2];
$this->getResult()->addValue(null, $this->getModuleName(), $info);
}
-
+
public function mustBePosted() { return true; }
-
+
public function getAllowedParams() {
return array (
'title' => null,