From: Reedy Date: Thu, 4 Oct 2012 13:52:03 +0000 (+0100) Subject: Bug 40756 - API: Call to a member function isGood() on a non-object in ApiDelete.php X-Git-Tag: 1.31.0-rc.0~22137^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=872b3f9d58483292ebf64154ed8baf9aab209445;p=lhc%2Fweb%2Fwiklou.git Bug 40756 - API: Call to a member function isGood() on a non-object in ApiDelete.php Change-Id: I88eefe177f1f6d77bed035ebe4967a8c714615f4 --- diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 2d36f19aa3..db4e931f4d 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -61,6 +61,9 @@ 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 @@ -98,11 +101,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 $token String delete token (same as edit token) + * @param $reason String|null 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 +131,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();