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
Move Database and subclasses to Rdbms namespace
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiDelete.php
diff --git
a/includes/api/ApiDelete.php
b/includes/api/ApiDelete.php
index
993c23e
..
99065c4
100644
(file)
--- a/
includes/api/ApiDelete.php
+++ b/
includes/api/ApiDelete.php
@@
-45,7
+45,7
@@
class ApiDelete extends ApiBase {
$pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' );
if ( !$pageObj->exists() ) {
$pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' );
if ( !$pageObj->exists() ) {
- $this->die
UsageMsg( 'notanartic
le' );
+ $this->die
WithError( 'apierror-missingtit
le' );
}
$titleObj = $pageObj->getTitle();
}
$titleObj = $pageObj->getTitle();
@@
-53,10
+53,7
@@
class ApiDelete extends ApiBase {
$user = $this->getUser();
// Check that the user is allowed to carry out the deletion
$user = $this->getUser();
// Check that the user is allowed to carry out the deletion
- $errors = $titleObj->getUserPermissionsErrors( 'delete', $user );
- if ( count( $errors ) ) {
- $this->dieUsageMsg( $errors[0] );
- }
+ $this->checkTitleUserPermissions( $titleObj, 'delete' );
// If change tagging was requested, check that the user is allowed to tag,
// and the tags are valid
// If change tagging was requested, check that the user is allowed to tag,
// and the tags are valid
@@
-80,9
+77,6
@@
class ApiDelete extends ApiBase {
$status = self::delete( $pageObj, $user, $reason, $params['tags'] );
}
$status = self::delete( $pageObj, $user, $reason, $params['tags'] );
}
- if ( is_array( $status ) ) {
- $this->dieUsageMsg( $status[0] );
- }
if ( !$status->isGood() ) {
$this->dieStatus( $status );
}
if ( !$status->isGood() ) {
$this->dieStatus( $status );
}
@@
-112,7
+106,7
@@
class ApiDelete extends ApiBase {
* @param User $user User doing the action
* @param string|null $reason Reason for the deletion. Autogenerated if null
* @param array $tags Tags to tag the deletion with
* @param User $user User doing the action
* @param string|null $reason Reason for the deletion. Autogenerated if null
* @param array $tags Tags to tag the deletion with
- * @return Status
|array
+ * @return Status
*/
protected static function delete( Page $page, User $user, &$reason = null, $tags = [] ) {
$title = $page->getTitle();
*/
protected static function delete( Page $page, User $user, &$reason = null, $tags = [] ) {
$title = $page->getTitle();
@@
-124,7
+118,7
@@
class ApiDelete extends ApiBase {
$hasHistory = false;
$reason = $page->getAutoDeleteReason( $hasHistory );
if ( $reason === false ) {
$hasHistory = false;
$reason = $page->getAutoDeleteReason( $hasHistory );
if ( $reason === false ) {
- return
[ [ 'cannotdelete', $title->getPrefixedText() ] ]
;
+ return
Status::newFatal( 'cannotdelete', $title->getPrefixedText() )
;
}
}
}
}
@@
-141,7
+135,7
@@
class ApiDelete extends ApiBase {
* @param string $reason Reason for the deletion. Autogenerated if null.
* @param bool $suppress Whether to mark all deleted versions as restricted
* @param array $tags Tags to tag the deletion with
* @param string $reason Reason for the deletion. Autogenerated if null.
* @param bool $suppress Whether to mark all deleted versions as restricted
* @param array $tags Tags to tag the deletion with
- * @return Status
|array
+ * @return Status
*/
protected static function deleteFile( Page $page, User $user, $oldimage,
&$reason = null, $suppress = false, $tags = []
*/
protected static function deleteFile( Page $page, User $user, $oldimage,
&$reason = null, $suppress = false, $tags = []
@@
-155,11
+149,11
@@
class ApiDelete extends ApiBase {
if ( $oldimage ) {
if ( !FileDeleteForm::isValidOldSpec( $oldimage ) ) {
if ( $oldimage ) {
if ( !FileDeleteForm::isValidOldSpec( $oldimage ) ) {
- return
[ [ 'invalidoldimage' ] ]
;
+ return
Status::newFatal( 'invalidoldimage' )
;
}
$oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $oldimage );
if ( !$oldfile->exists() || !$oldfile->isLocal() || $oldfile->getRedirected() ) {
}
$oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $oldimage );
if ( !$oldfile->exists() || !$oldfile->isLocal() || $oldfile->getRedirected() ) {
- return
[ [ 'nodeleteablefile' ] ]
;
+ return
Status::newFatal( 'nodeleteablefile' )
;
}
}
}
}
@@
-224,6
+218,6
@@
class ApiDelete extends ApiBase {
}
public function getHelpUrls() {
}
public function getHelpUrls() {
- return 'https://www.mediawiki.org/wiki/API:Delete';
+ return 'https://www.mediawiki.org/wiki/
Special:MyLanguage/
API:Delete';
}
}
}
}