API:
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Sep 2008 21:39:36 +0000 (21:39 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Sep 2008 21:39:36 +0000 (21:39 +0000)
* 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
includes/api/ApiMove.php
includes/api/ApiQuery.php

index 3383e3d..5548b18 100644 (file)
@@ -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',
                );
index 9eb859b..def43f1 100644 (file)
@@ -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'];
                        }
                }
 
index 80edb31..3494f0a 100644 (file)
@@ -478,7 +478,6 @@ class ApiQuery extends ApiBase {
                return $psModule->makeHelpMsgParameters() . parent :: makeHelpMsgParameters();
        }
 
-       // @todo should work correctly
        public function shouldCheckMaxlag() {
                return true;
        }