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
Merge "Warn for uploads with new name but same content as local file"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiUndelete.php
diff --git
a/includes/api/ApiUndelete.php
b/includes/api/ApiUndelete.php
index
e24f2ce
..
3aa7b60
100644
(file)
--- a/
includes/api/ApiUndelete.php
+++ b/
includes/api/ApiUndelete.php
@@
-33,18
+33,19
@@
class ApiUndelete extends ApiBase {
$this->useTransactionalTimeLimit();
$params = $this->extractRequestParams();
$this->useTransactionalTimeLimit();
$params = $this->extractRequestParams();
- $user = $this->getUser();
- if ( !$user->isAllowed( 'undelete' ) ) {
- $this->dieUsageMsg( 'permdenied-undelete' );
- }
+ $user = $this->getUser();
if ( $user->isBlocked() ) {
$this->dieBlocked( $user->getBlock() );
}
$titleObj = Title::newFromText( $params['title'] );
if ( !$titleObj || $titleObj->isExternal() ) {
if ( $user->isBlocked() ) {
$this->dieBlocked( $user->getBlock() );
}
$titleObj = Title::newFromText( $params['title'] );
if ( !$titleObj || $titleObj->isExternal() ) {
- $this->dieUsageMsg( [ 'invalidtitle', $params['title'] ] );
+ $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] );
+ }
+
+ if ( !$titleObj->userCan( 'undelete', $user, 'secure' ) ) {
+ $this->dieWithError( 'permdenied-undelete' );
}
// Check if user can add tags
}
// Check if user can add tags
@@
-76,7
+77,7
@@
class ApiUndelete extends ApiBase {
$params['tags']
);
if ( !is_array( $retval ) ) {
$params['tags']
);
if ( !is_array( $retval ) ) {
- $this->die
UsageMsg( 'canno
tundelete' );
+ $this->die
WithError( 'apierror-can
tundelete' );
}
if ( $retval[1] ) {
}
if ( $retval[1] ) {
@@
-147,6
+148,6
@@
class ApiUndelete extends ApiBase {
}
public function getHelpUrls() {
}
public function getHelpUrls() {
- return 'https://www.mediawiki.org/wiki/API:Undelete';
+ return 'https://www.mediawiki.org/wiki/
Special:MyLanguage/
API:Undelete';
}
}
}
}