summaryrefslogtreecommitdiff
path: root/includes/api/ApiDelete.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiDelete.php')
-rw-r--r--includes/api/ApiDelete.php28
1 files changed, 11 insertions, 17 deletions
diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php
index 2d36f19a..aea10482 100644
--- a/includes/api/ApiDelete.php
+++ b/includes/api/ApiDelete.php
@@ -32,10 +32,6 @@
*/
class ApiDelete extends ApiBase {
- public function __construct( $main, $action ) {
- parent::__construct( $main, $action );
- }
-
/**
* Extracts the title, token, and reason from the request parameters and invokes
* the local delete() function with these as arguments. It does not make use of
@@ -61,9 +57,11 @@ class ApiDelete extends ApiBase {
$status = self::delete( $pageObj, $user, $params['token'], $reason );
}
+ if ( is_array( $status ) ) {
+ $this->dieUsageMsg( $status[0] );
+ }
if ( !$status->isGood() ) {
- $errors = $status->getErrorsArray();
- $this->dieUsageMsg( $errors[0] ); // We don't care about multiple errors, just report one of them
+ $this->dieStatus( $status );
}
// Deprecated parameters
@@ -98,11 +96,11 @@ class ApiDelete extends ApiBase {
/**
* We have our own delete() function, since Article.php's implementation is split in two phases
*
- * @param $page WikiPage object to work on
+ * @param $page Page|WikiPage object to work on
* @param $user User doing the action
- * @param $token String: delete token (same as edit token)
- * @param $reason String: reason for the deletion. Autogenerated if NULL
- * @return Status
+ * @param string $token delete token (same as edit token)
+ * @param string|null $reason reason for the deletion. Autogenerated if NULL
+ * @return Status|array
*/
public static function delete( Page $page, User $user, $token, &$reason = null ) {
$title = $page->getTitle();
@@ -128,13 +126,13 @@ class ApiDelete extends ApiBase {
}
/**
- * @param $page WikiPage object to work on
+ * @param $page WikiPage|Page object to work on
* @param $user User doing the action
* @param $token
* @param $oldimage
* @param $reason
* @param $suppress bool
- * @return Status
+ * @return Status|array
*/
public static function deleteFile( Page $page, User $user, $token, $oldimage, &$reason = null, $suppress = false ) {
$title = $page->getTitle();
@@ -161,7 +159,7 @@ class ApiDelete extends ApiBase {
if ( is_null( $reason ) ) { // Log and RC don't like null reasons
$reason = '';
}
- return FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress );
+ return FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress, $user );
}
public function mustBePosted() {
@@ -264,8 +262,4 @@ class ApiDelete extends ApiBase {
public function getHelpUrls() {
return 'https://www.mediawiki.org/wiki/API:Delete';
}
-
- public function getVersion() {
- return __CLASS__ . ': $Id$';
- }
}