X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUndelete.php;h=412e2837884150fa2b9b7de978595057c6d130e7;hb=f830c86e06ccc3ba28872314f546a8dbb7665411;hp=6dd1b2c997527b64dd2acc34e3e36fb174bd15cd;hpb=68bbfc12c0eec54336bd9cde7386d265099f2685;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 6dd1b2c997..412e283788 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -28,7 +28,7 @@ if (!defined('MEDIAWIKI')) { } /** - * @addtogroup API + * @ingroup API */ class ApiUndelete extends ApiBase { @@ -40,7 +40,7 @@ class ApiUndelete extends ApiBase { global $wgUser; $this->getMain()->requestWriteMode(); $params = $this->extractRequestParams(); - + $titleObj = NULL; if(!isset($params['title'])) $this->dieUsageMsg(array('missingparam', 'title')); @@ -61,6 +61,8 @@ class ApiUndelete extends ApiBase { $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) @@ -73,16 +75,19 @@ class ApiUndelete extends ApiBase { 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,