dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
API: Overhaul token handling
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiUndelete.php
diff --git
a/includes/api/ApiUndelete.php
b/includes/api/ApiUndelete.php
index
332ed51
..
07aad9f
100644
(file)
--- a/
includes/api/ApiUndelete.php
+++ b/
includes/api/ApiUndelete.php
@@
-56,11
+56,11
@@
class ApiUndelete extends ApiBase {
$params['timestamps'][$i] = wfTimestamp( TS_MW, $ts );
}
$params['timestamps'][$i] = wfTimestamp( TS_MW, $ts );
}
- $pa = new PageArchive( $titleObj );
+ $pa = new PageArchive( $titleObj
, $this->getConfig()
);
$retval = $pa->undelete(
( isset( $params['timestamps'] ) ? $params['timestamps'] : array() ),
$params['reason'],
$retval = $pa->undelete(
( isset( $params['timestamps'] ) ? $params['timestamps'] : array() ),
$params['reason'],
-
array()
,
+
$params['fileids']
,
false,
$this->getUser()
);
false,
$this->getUser()
);
@@
-70,7
+70,7
@@
class ApiUndelete extends ApiBase {
if ( $retval[1] ) {
wfRunHooks( 'FileUndeleteComplete',
if ( $retval[1] ) {
wfRunHooks( 'FileUndeleteComplete',
- array( $titleObj,
array()
, $this->getUser(), $params['reason'] ) );
+ array( $titleObj,
$params['fileids']
, $this->getUser(), $params['reason'] ) );
}
$this->setWatch( $params['watchlist'], $titleObj );
}
$this->setWatch( $params['watchlist'], $titleObj );
@@
-96,15
+96,15
@@
class ApiUndelete extends ApiBase {
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
- 'token' => array(
- ApiBase::PARAM_TYPE => 'string',
- ApiBase::PARAM_REQUIRED => true
- ),
'reason' => '',
'timestamps' => array(
ApiBase::PARAM_TYPE => 'timestamp',
ApiBase::PARAM_ISMULTI => true,
),
'reason' => '',
'timestamps' => array(
ApiBase::PARAM_TYPE => 'timestamp',
ApiBase::PARAM_ISMULTI => true,
),
+ 'fileids' => array(
+ ApiBase::PARAM_TYPE => 'integer',
+ ApiBase::PARAM_ISMULTI => true,
+ ),
'watchlist' => array(
ApiBase::PARAM_DFLT => 'preferences',
ApiBase::PARAM_TYPE => array(
'watchlist' => array(
ApiBase::PARAM_DFLT => 'preferences',
ApiBase::PARAM_TYPE => array(
@@
-120,48
+120,30
@@
class ApiUndelete extends ApiBase {
public function getParamDescription() {
return array(
'title' => 'Title of the page you want to restore',
public function getParamDescription() {
return array(
'title' => 'Title of the page you want to restore',
- 'token' => 'An undelete token previously retrieved through list=deletedrevs',
'reason' => 'Reason for restoring',
'reason' => 'Reason for restoring',
- 'timestamps' => 'Timestamps of the revisions to restore. If not set, all ' .
- 'revisions will be restored.',
+ 'timestamps' => array(
+ 'Timestamps of the revisions to restore.',
+ 'If both timestamps and fileids are empty, all will be restored.',
+ ),
+ 'fileids' => array(
+ 'IDs of the file revisions to restore.',
+ 'If both timestamps and fileids are empty, all will be restored.',
+ ),
'watchlist' => 'Unconditionally add or remove the page from your ' .
'watchlist, use preferences or do not change watch',
);
}
'watchlist' => 'Unconditionally add or remove the page from your ' .
'watchlist, use preferences or do not change watch',
);
}
- public function getResultProperties() {
- return array(
- '' => array(
- 'title' => 'string',
- 'revisions' => 'integer',
- 'filerevisions' => 'integer',
- 'reason' => 'string'
- )
- );
- }
-
public function getDescription() {
return array(
'Restore certain revisions of a deleted page. A list of deleted revisions ',
public function getDescription() {
return array(
'Restore certain revisions of a deleted page. A list of deleted revisions ',
- '(including timestamps) can be retrieved through list=deletedrevs.'
+ '(including timestamps) can be retrieved through list=deletedrevs, and a list',
+ 'of deleted file ids can be retrieved through list=filearchive.'
);
}
);
}
- public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array( 'permdenied-undelete' ),
- array( 'blockedtext' ),
- array( 'invalidtitle', 'title' ),
- array( 'cannotundelete' ),
- ) );
- }
-
public function needsToken() {
public function needsToken() {
- return true;
- }
-
- public function getTokenSalt() {
- return '';
+ return 'csrf';
}
public function getExamples() {
}
public function getExamples() {