X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiDelete.php;h=21264bcbb105c993bb54613ac4e61f86f61f40b6;hb=90adb4879df6b8b31b3b619d13911a365891ee74;hp=422524db05cb6fb48a06e55a93b7ac0e29a881f0;hpb=c8ddc2ab37639803ff5987b57179e4967d33063d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 422524db05..21264bcbb1 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -61,8 +61,7 @@ class ApiDelete extends ApiBase { $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 @@ -99,8 +98,8 @@ class ApiDelete extends ApiBase { * * @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|null reason for the deletion. Autogenerated if NULL + * @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 ) { @@ -122,6 +121,7 @@ class ApiDelete extends ApiBase { } $error = ''; + // Luckily, Article.php provides a reusable delete function that does the hard work for us return $page->doDeleteArticleReal( $reason, false, 0, true, $error ); } @@ -160,6 +160,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, $user ); } @@ -205,6 +206,7 @@ class ApiDelete extends ApiBase { public function getParamDescription() { $p = $this->getModulePrefix(); + return array( 'title' => "Title of the page you want to delete. Cannot be used together with {$p}pageid", 'pageid' => "Page ID of the page you want to delete. Cannot be used together with {$p}title",