Single messages can be passed as strings to Api::dieUsageMsg()
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 19 May 2011 17:51:16 +0000 (17:51 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 19 May 2011 17:51:16 +0000 (17:51 +0000)
Since r88045

19 files changed:
includes/api/ApiBlock.php
includes/api/ApiDelete.php
includes/api/ApiEditPage.php
includes/api/ApiFileRevert.php
includes/api/ApiImport.php
includes/api/ApiMain.php
includes/api/ApiMove.php
includes/api/ApiProtect.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiRollback.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php
includes/api/ApiWatch.php

index e0a3506..94a8546 100644 (file)
@@ -58,7 +58,7 @@ class ApiBlock extends ApiBase {
                }
 
                if ( !$wgUser->isAllowed( 'block' ) ) {
-                       $this->dieUsageMsg( array( 'cantblock' ) );
+                       $this->dieUsageMsg( 'cantblock' );
                }
                # bug 15810: blocked admins should have limited access here
                if ( $wgUser->isBlocked() ) {
@@ -68,10 +68,10 @@ class ApiBlock extends ApiBase {
                        }
                }
                if ( $params['hidename'] && !$wgUser->isAllowed( 'hideuser' ) ) {
-                       $this->dieUsageMsg( array( 'canthide' ) );
+                       $this->dieUsageMsg( 'canthide' );
                }
                if ( $params['noemail'] && !SpecialBlock::canBlockEmail( $wgUser ) ) {
-                       $this->dieUsageMsg( array( 'cantblock-email' ) );
+                       $this->dieUsageMsg( 'cantblock-email' );
                }
 
                $data = array(
index c5cf855..06e0c64 100644 (file)
@@ -65,7 +65,7 @@ class ApiDelete extends ApiBase {
                        }
                }
                if ( !$titleObj->exists() ) {
-                       $this->dieUsageMsg( array( 'notanarticle' ) );
+                       $this->dieUsageMsg( 'notanarticle' );
                }
 
                $reason = ( isset( $params['reason'] ) ? $params['reason'] : null );
index 3536fdf..cda3429 100644 (file)
@@ -50,7 +50,7 @@ class ApiEditPage extends ApiBase {
                                is_null( $params['prependtext'] ) &&
                                $params['undo'] == 0 )
                {
-                       $this->dieUsageMsg( array( 'missingtext' ) );
+                       $this->dieUsageMsg( 'missingtext' );
                }
 
                $titleObj = Title::newFromText( $params['title'] );
@@ -93,10 +93,10 @@ class ApiEditPage extends ApiBase {
                $wgTitle = $titleObj;
 
                if ( $params['createonly'] && $titleObj->exists() ) {
-                       $this->dieUsageMsg( array( 'createonly-exists' ) );
+                       $this->dieUsageMsg( 'createonly-exists' );
                }
                if ( $params['nocreate'] && !$titleObj->exists() ) {
-                       $this->dieUsageMsg( array( 'nocreate-missing' ) );
+                       $this->dieUsageMsg( 'nocreate-missing' );
                }
 
                // Now let's check whether we're even allowed to do this
@@ -164,7 +164,7 @@ class ApiEditPage extends ApiBase {
 
                        $newtext = $articleObj->getUndoText( $undoRev, $undoafterRev );
                        if ( $newtext === false ) {
-                               $this->dieUsageMsg( array( 'undo-failure' ) );
+                               $this->dieUsageMsg( 'undo-failure' );
                        }
                        $params['text'] = $newtext;
                        // If no summary was given and we only undid one rev,
@@ -176,7 +176,7 @@ class ApiEditPage extends ApiBase {
 
                // See if the MD5 hash checks out
                if ( !is_null( $params['md5'] ) && md5( $toMD5 ) !== $params['md5'] ) {
-                       $this->dieUsageMsg( array( 'hashcheckfailed' ) );
+                       $this->dieUsageMsg( 'hashcheckfailed' );
                }
 
                $ep = new EditPage( $articleObj );
@@ -259,7 +259,7 @@ class ApiEditPage extends ApiBase {
                                $this->getResult()->addValue( null, $this->getModuleName(), $r );
                                return;
                        } else {
-                               $this->dieUsageMsg( array( 'hookaborted' ) );
+                               $this->dieUsageMsg( 'hookaborted' );
                        }
                }
 
@@ -278,54 +278,54 @@ class ApiEditPage extends ApiBase {
                switch( $retval ) {
                        case EditPage::AS_HOOK_ERROR:
                        case EditPage::AS_HOOK_ERROR_EXPECTED:
-                               $this->dieUsageMsg( array( 'hookaborted' ) );
+                               $this->dieUsageMsg( 'hookaborted' );
 
                        case EditPage::AS_IMAGE_REDIRECT_ANON:
-                               $this->dieUsageMsg( array( 'noimageredirect-anon' ) );
+                               $this->dieUsageMsg( 'noimageredirect-anon' );
 
                        case EditPage::AS_IMAGE_REDIRECT_LOGGED:
-                               $this->dieUsageMsg( array( 'noimageredirect-logged' ) );
+                               $this->dieUsageMsg( 'noimageredirect-logged' );
 
                        case EditPage::AS_SPAM_ERROR:
                                $this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
 
                        case EditPage::AS_FILTERING:
-                               $this->dieUsageMsg( array( 'filtered' ) );
+                               $this->dieUsageMsg( 'filtered' );
 
                        case EditPage::AS_BLOCKED_PAGE_FOR_USER:
-                               $this->dieUsageMsg( array( 'blockedtext' ) );
+                               $this->dieUsageMsg( 'blockedtext' );
 
                        case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
                        case EditPage::AS_CONTENT_TOO_BIG:
                                $this->dieUsageMsg( array( 'contenttoobig', $wgMaxArticleSize ) );
 
                        case EditPage::AS_READ_ONLY_PAGE_ANON:
-                               $this->dieUsageMsg( array( 'noedit-anon' ) );
+                               $this->dieUsageMsg( 'noedit-anon' );
 
                        case EditPage::AS_READ_ONLY_PAGE_LOGGED:
-                               $this->dieUsageMsg( array( 'noedit' ) );
+                               $this->dieUsageMsg( 'noedit' );
 
                        case EditPage::AS_READ_ONLY_PAGE:
                                $this->dieReadOnly();
 
                        case EditPage::AS_RATE_LIMITED:
-                               $this->dieUsageMsg( array( 'actionthrottledtext' ) );
+                               $this->dieUsageMsg( 'actionthrottledtext' );
 
                        case EditPage::AS_ARTICLE_WAS_DELETED:
-                               $this->dieUsageMsg( array( 'wasdeleted' ) );
+                               $this->dieUsageMsg( 'wasdeleted' );
 
                        case EditPage::AS_NO_CREATE_PERMISSION:
-                               $this->dieUsageMsg( array( 'nocreate-loggedin' ) );
+                               $this->dieUsageMsg( 'nocreate-loggedin' );
 
                        case EditPage::AS_BLANK_ARTICLE:
-                               $this->dieUsageMsg( array( 'blankpage' ) );
+                               $this->dieUsageMsg( 'blankpage' );
 
                        case EditPage::AS_CONFLICT_DETECTED:
-                               $this->dieUsageMsg( array( 'editconflict' ) );
+                               $this->dieUsageMsg( 'editconflict' );
 
                        // case EditPage::AS_SUMMARY_NEEDED: Can't happen since we set wpIgnoreBlankSummary
                        case EditPage::AS_TEXTBOX_EMPTY:
-                               $this->dieUsageMsg( array( 'emptynewsection' ) );
+                               $this->dieUsageMsg( 'emptynewsection' );
 
                        case EditPage::AS_SUCCESS_NEW_ARTICLE:
                                $r['new'] = '';
@@ -351,7 +351,7 @@ class ApiEditPage extends ApiBase {
                                break;
 
                        case EditPage::AS_SUMMARY_NEEDED:
-                               $this->dieUsageMsg( array( 'summaryrequired' ) );
+                               $this->dieUsageMsg( 'summaryrequired' );
 
                        case EditPage::AS_END:
                                // This usually means some kind of race condition
index c89d7ab..371ef67 100644 (file)
@@ -101,14 +101,14 @@ class ApiFileRevert extends ApiBase {
                // Check if the file really exists
                $this->file = wfLocalFile( $title );
                if ( !$this->file->exists() ) {
-                       $this->dieUsageMsg( array( 'notanarticle' ) );
+                       $this->dieUsageMsg( 'notanarticle' );
                }
 
                // Check if the archivename is valid for this file
                $this->archiveName = $this->params['archivename'];
                $oldFile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $this->archiveName );
                if ( !$oldFile->exists() ) {
-                       $this->dieUsageMsg( array( 'filerevert-badversion' ) );
+                       $this->dieUsageMsg( 'filerevert-badversion' );
                }
        }
 
index f01035c..5c05daf 100644 (file)
@@ -48,7 +48,7 @@ class ApiImport extends ApiBase {
                $isUpload = false;
                if ( isset( $params['interwikisource'] ) ) {
                        if ( !$wgUser->isAllowed( 'import' ) ) {
-                               $this->dieUsageMsg( array( 'cantimport' ) );
+                               $this->dieUsageMsg( 'cantimport' );
                        }
                        if ( !isset( $params['interwikipage'] ) ) {
                                $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) );
@@ -62,7 +62,7 @@ class ApiImport extends ApiBase {
                } else {
                        $isUpload = true;
                        if ( !$wgUser->isAllowed( 'importupload' ) ) {
-                               $this->dieUsageMsg( array( 'cantimport-upload' ) );
+                               $this->dieUsageMsg( 'cantimport-upload' );
                        }
                        $source = ImportStreamSource::newFromUpload( 'xml' );
                }
index cf06e5a..a15faee 100644 (file)
@@ -568,7 +568,7 @@ class ApiMain extends ApiBase {
                        } else {
                                global $wgUser;
                                if ( !$wgUser->matchEditToken( $moduleParams['token'], $salt, $this->getMain()->getRequest() ) ) {
-                                       $this->dieUsageMsg( array( 'sessionfailure' ) );
+                                       $this->dieUsageMsg( 'sessionfailure' );
                                }
                        }
                }
@@ -611,14 +611,14 @@ class ApiMain extends ApiBase {
                if ( $module->isReadMode() && !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) &&
                        !$wgUser->isAllowed( 'read' ) )
                {
-                       $this->dieUsageMsg( array( 'readrequired' ) );
+                       $this->dieUsageMsg( 'readrequired' );
                }
                if ( $module->isWriteMode() ) {
                        if ( !$this->mEnableWrite ) {
-                               $this->dieUsageMsg( array( 'writedisabled' ) );
+                               $this->dieUsageMsg( 'writedisabled' );
                        }
                        if ( !$wgUser->isAllowed( 'writeapi' ) ) {
-                               $this->dieUsageMsg( array( 'writerequired' ) );
+                               $this->dieUsageMsg( 'writerequired' );
                        }
                        if ( wfReadOnly() ) {
                                $this->dieReadOnly();
index 3132de6..85bd5ad 100644 (file)
@@ -61,7 +61,7 @@ class ApiMove extends ApiBase {
                }
 
                if ( !$fromTitle->exists() ) {
-                       $this->dieUsageMsg( array( 'notanarticle' ) );
+                       $this->dieUsageMsg( 'notanarticle' );
                }
                $fromTalk = $fromTitle->getTalkPage();
 
@@ -76,9 +76,9 @@ class ApiMove extends ApiBase {
                        && wfFindFile( $toTitle ) )
                {
                        if ( !$params['ignorewarnings'] && $wgUser->isAllowed( 'reupload-shared' ) ) {
-                               $this->dieUsageMsg( array( 'sharedfile-exists' ) );
+                               $this->dieUsageMsg( 'sharedfile-exists' );
                        } elseif ( !$wgUser->isAllowed( 'reupload-shared' ) ) {
-                               $this->dieUsageMsg( array( 'cantoverwrite-sharedfile' ) );
+                               $this->dieUsageMsg( 'cantoverwrite-sharedfile' );
                        }
                }
 
index 34c56d7..ccb7efe 100644 (file)
@@ -73,10 +73,10 @@ class ApiProtect extends ApiBase {
                        $protections[$p[0]] = ( $p[1] == 'all' ? '' : $p[1] );
 
                        if ( $titleObj->exists() && $p[0] == 'create' ) {
-                               $this->dieUsageMsg( array( 'create-titleexists' ) );
+                               $this->dieUsageMsg( 'create-titleexists' );
                        }
                        if ( !$titleObj->exists() && $p[0] != 'create' ) {
-                               $this->dieUsageMsg( array( 'missingtitle-createonly' ) );
+                               $this->dieUsageMsg( 'missingtitle-createonly' );
                        }
 
                        if ( !in_array( $p[0], $restrictionTypes ) && $p[0] != 'create' ) {
index b65ea4b..f1440af 100644 (file)
@@ -104,7 +104,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                }
 
                if ( isset( $show['hidden'] ) && isset( $show['!hidden'] ) ) {
-                       $this->dieUsageMsg( array( 'show' ) );
+                       $this->dieUsageMsg( 'show' );
                }
                if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) || isset( $prop['hidden'] ) )
                {
index d6d3ebc..5b379d9 100644 (file)
@@ -82,7 +82,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
 
                $qp = new $this->qpMap[$params['page']]();
                if ( !$qp->userCanExecute( $wgUser ) ) {
-                       $this->dieUsageMsg( array( 'specialpage-cantexecute' ) );
+                       $this->dieUsageMsg( 'specialpage-cantexecute' );
                }
 
                $r = array( 'name' => $params['page'] );
index b00db35..896914f 100644 (file)
@@ -158,7 +158,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                                        || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
                                        || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
                        ) {
-                               $this->dieUsageMsg( array( 'show' ) );
+                               $this->dieUsageMsg( 'show' );
                        }
 
                        // Check permissions
index 5c863f9..9e68b0f 100644 (file)
@@ -189,7 +189,7 @@ class ApiQueryContributions extends ApiQueryBase {
                        $show = array_flip( $show );
                        if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
                                        || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) ) {
-                               $this->dieUsageMsg( array( 'show' ) );
+                               $this->dieUsageMsg( 'show' );
                        }
 
                        $this->addWhereIf( 'rev_minor_edit = 0', isset( $show['!minor'] ) );
index fe0c180..1aaa450 100644 (file)
@@ -147,7 +147,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                        || ( isset ( $show['patrolled'] ) && isset ( $show['!patrolled'] ) )
                        )
                        {
-                               $this->dieUsageMsg( array( 'show' ) );
+                               $this->dieUsageMsg( 'show' );
                        }
 
                        // Check permissions.
index fa76956..126f6d8 100644 (file)
@@ -63,7 +63,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                $prop = array_flip( (array)$params['prop'] );
                $show = array_flip( (array)$params['show'] );
                if ( isset( $show['changed'] ) && isset( $show['!changed'] ) ) {
-                       $this->dieUsageMsg( array( 'show' ) );
+                       $this->dieUsageMsg( 'show' );
                }
 
                $this->addTables( 'watchlist' );
@@ -207,4 +207,4 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
\ No newline at end of file
+}
index fee9622..e845df6 100644 (file)
@@ -178,7 +178,7 @@ class ApiRollback extends ApiBase {
                        $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
                }
                if ( !$this->mTitleObj->exists() ) {
-                       $this->dieUsageMsg( array( 'notanarticle' ) );
+                       $this->dieUsageMsg( 'notanarticle' );
                }
 
                return $this->mTitleObj;
index bdafe13..6865787 100644 (file)
@@ -55,20 +55,20 @@ class ApiUnblock extends ApiBase {
                }
 
                if ( is_null( $params['id'] ) && is_null( $params['user'] ) ) {
-                       $this->dieUsageMsg( array( 'unblock-notarget' ) );
+                       $this->dieUsageMsg( 'unblock-notarget' );
                }
                if ( !is_null( $params['id'] ) && !is_null( $params['user'] ) ) {
-                       $this->dieUsageMsg( array( 'unblock-idanduser' ) );
+                       $this->dieUsageMsg( 'unblock-idanduser' );
                }
 
                if ( !$wgUser->isAllowed( 'block' ) ) {
-                       $this->dieUsageMsg( array( 'cantunblock' ) );
+                       $this->dieUsageMsg( 'cantunblock' );
                }
                # bug 15810: blocked admins should have limited access here
                if ( $wgUser->isBlocked() ) {
                        $status = SpecialBlock::checkUnblockSelf( $params['user'] );
                        if ( $status !== true ) {
-                               $this->dieUsageMsg( array( $status ) );
+                               $this->dieUsageMsg( $status );
                        }
                }
 
index a027b7f..615b224 100644 (file)
@@ -43,11 +43,11 @@ class ApiUndelete extends ApiBase {
                $params = $this->extractRequestParams();
 
                if ( !$wgUser->isAllowed( 'undelete' ) ) {
-                       $this->dieUsageMsg( array( 'permdenied-undelete' ) );
+                       $this->dieUsageMsg( 'permdenied-undelete' );
                }
 
                if ( $wgUser->isBlocked() ) {
-                       $this->dieUsageMsg( array( 'blockedtext' ) );
+                       $this->dieUsageMsg( 'blockedtext' );
                }
 
                $titleObj = Title::newFromText( $params['title'] );
@@ -69,7 +69,7 @@ class ApiUndelete extends ApiBase {
                $pa = new PageArchive( $titleObj );
                $retval = $pa->undelete( ( isset( $params['timestamps'] ) ? $params['timestamps'] : array() ), $params['reason'] );
                if ( !is_array( $retval ) ) {
-                       $this->dieUsageMsg( array( 'cannotundelete' ) );
+                       $this->dieUsageMsg( 'cannotundelete' );
                }
 
                if ( $retval[1] ) {
index 46043a7..5c39e21 100644 (file)
@@ -50,7 +50,7 @@ class ApiUpload extends ApiBase {
 
                // Check whether upload is enabled
                if ( !UploadBase::isEnabled() ) {
-                       $this->dieUsageMsg( array( 'uploaddisabled' ) );
+                       $this->dieUsageMsg( 'uploaddisabled' );
                }
 
                // Parameter handling
@@ -208,7 +208,7 @@ class ApiUpload extends ApiBase {
                        // Upload stashed in a previous request
                        $sessionData = $request->getSessionData( UploadBase::getSessionKeyName() );
                        if ( !UploadFromStash::isValidSessionKey( $this->mParams['sessionkey'], $sessionData ) ) {
-                               $this->dieUsageMsg( array( 'invalid-session-key' ) );
+                               $this->dieUsageMsg( 'invalid-session-key' );
                        }
 
                        $this->mUpload = new UploadFromStash();
@@ -225,7 +225,7 @@ class ApiUpload extends ApiBase {
                } elseif ( isset( $this->mParams['url'] ) ) {
                        // Make sure upload by URL is enabled:
                        if ( !UploadFromUrl::isEnabled() ) {
-                               $this->dieUsageMsg( array( 'copyuploaddisabled' ) );
+                               $this->dieUsageMsg( 'copyuploaddisabled' );
                        }
 
                        $async = false;
@@ -265,7 +265,7 @@ class ApiUpload extends ApiBase {
                        if ( !$user->isLoggedIn() ) {
                                $this->dieUsageMsg( array( 'mustbeloggedin', 'upload' ) );
                        } else {
-                               $this->dieUsageMsg( array( 'badaccess-groups' ) );
+                               $this->dieUsageMsg( 'badaccess-groups' );
                        }
                }
        }
index 685306d..7eb6168 100644 (file)
@@ -66,7 +66,7 @@ class ApiWatch extends ApiBase {
                        $success = Action::factory( 'watch', $article )->execute();
                }
                if ( !$success ) {
-                       $this->dieUsageMsg( array( 'hookaborted' ) );
+                       $this->dieUsageMsg( 'hookaborted' );
                }
                $this->getResult()->addValue( null, $this->getModuleName(), $res );
        }