From b62ddd3971d6275231a51b2d1b619e9231792851 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 25 Sep 2008 21:39:36 +0000 Subject: [PATCH] API: * Title::moveTo() has been returning a getUserPermissionsErrors()-like array for ages now, let's use it correctly in ApiMove and skip the double-checks * Remove some outdated TODO/FIXME comments --- includes/api/ApiEmailUser.php | 1 - includes/api/ApiMove.php | 21 ++------------------- includes/api/ApiQuery.php | 1 - 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 3383e3dd44..5548b18432 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -94,7 +94,6 @@ class ApiEmailUser extends ApiBase { 'target' => 'User to send email to', 'subject' => 'Subject header', 'text' => 'Mail body', - // FIXME: How to properly get a token? 'token' => 'A token previously acquired via prop=info', 'ccme' => 'Send a copy of this mail to me', ); diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 9eb859b43a..def43f1c2e 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -66,27 +66,10 @@ class ApiMove extends ApiBase { $this->dieUsageMsg(array('invalidtitle', $params['to'])); $toTalk = $toTitle->getTalkPage(); - // Run getUserPermissionsErrors() here so we get message arguments too, - // rather than just a message key. The latter is troublesome for messages - // that use arguments. - // FIXME: moveTo() should really return an array, requires some - // refactoring of other code, though (mainly SpecialMovepage.php) - $errors = array_merge($fromTitle->getUserPermissionsErrors('move', $wgUser), - $fromTitle->getUserPermissionsErrors('edit', $wgUser), - $toTitle->getUserPermissionsErrors('move', $wgUser), - $toTitle->getUserPermissionsErrors('edit', $wgUser)); - if(!empty($errors)) - // We don't care about multiple errors, just report one of them - $this->dieUsageMsg(current($errors)); - $hookErr = null; - $retval = $fromTitle->moveTo($toTitle, true, $params['reason'], !$params['noredirect']); if($retval !== true) - { - # FIXME: Title::moveTo() sometimes returns a string $this->dieUsageMsg(reset($retval)); - } $r = array('from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason']); if(!$params['noredirect'] || !$wgUser->isAllowed('suppressredirect')) @@ -105,8 +88,8 @@ class ApiMove extends ApiBase { // We're not gonna dieUsage() on failure, since we already changed something else { - $r['talkmove-error-code'] = ApiBase::$messageMap[$retval]['code']; - $r['talkmove-error-info'] = ApiBase::$messageMap[$retval]['info']; + $r['talkmove-error-code'] = ApiBase::$messageMap[current($retval)]['code']; + $r['talkmove-error-info'] = ApiBase::$messageMap[current($retval)]['info']; } } diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 80edb319ed..3494f0ad97 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -478,7 +478,6 @@ class ApiQuery extends ApiBase { return $psModule->makeHelpMsgParameters() . parent :: makeHelpMsgParameters(); } - // @todo should work correctly public function shouldCheckMaxlag() { return true; } -- 2.20.1