http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88416
Revision: 88416
Author: hashar
Date: 2011-05-19 17:51:16 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Single messages can be passed as strings to Api::dieUsageMsg()
Since r88045
Modified Paths:
--------------
trunk/phase3/includes/api/ApiBlock.php
trunk/phase3/includes/api/ApiDelete.php
trunk/phase3/includes/api/ApiEditPage.php
trunk/phase3/includes/api/ApiFileRevert.php
trunk/phase3/includes/api/ApiImport.php
trunk/phase3/includes/api/ApiMain.php
trunk/phase3/includes/api/ApiMove.php
trunk/phase3/includes/api/ApiProtect.php
trunk/phase3/includes/api/ApiQueryCategories.php
trunk/phase3/includes/api/ApiQueryQueryPage.php
trunk/phase3/includes/api/ApiQueryRecentChanges.php
trunk/phase3/includes/api/ApiQueryUserContributions.php
trunk/phase3/includes/api/ApiQueryWatchlist.php
trunk/phase3/includes/api/ApiQueryWatchlistRaw.php
trunk/phase3/includes/api/ApiRollback.php
trunk/phase3/includes/api/ApiUnblock.php
trunk/phase3/includes/api/ApiUndelete.php
trunk/phase3/includes/api/ApiUpload.php
trunk/phase3/includes/api/ApiWatch.php
Modified: trunk/phase3/includes/api/ApiBlock.php
===================================================================
--- trunk/phase3/includes/api/ApiBlock.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiBlock.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -58,7 +58,7 @@
}
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 @@
}
}
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(
Modified: trunk/phase3/includes/api/ApiDelete.php
===================================================================
--- trunk/phase3/includes/api/ApiDelete.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiDelete.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -65,7 +65,7 @@
}
}
if ( !$titleObj->exists() ) {
- $this->dieUsageMsg( array( 'notanarticle' ) );
+ $this->dieUsageMsg( 'notanarticle' );
}
$reason = ( isset( $params['reason'] ) ? $params['reason'] :
null );
Modified: trunk/phase3/includes/api/ApiEditPage.php
===================================================================
--- trunk/phase3/includes/api/ApiEditPage.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiEditPage.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -50,7 +50,7 @@
is_null( $params['prependtext'] ) &&
$params['undo'] == 0 )
{
- $this->dieUsageMsg( array( 'missingtext' ) );
+ $this->dieUsageMsg( 'missingtext' );
}
$titleObj = Title::newFromText( $params['title'] );
@@ -93,10 +93,10 @@
$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 @@
$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 @@
// 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 @@
$this->getResult()->addValue( null,
$this->getModuleName(), $r );
return;
} else {
- $this->dieUsageMsg( array( 'hookaborted' ) );
+ $this->dieUsageMsg( 'hookaborted' );
}
}
@@ -278,54 +278,54 @@
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 @@
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
Modified: trunk/phase3/includes/api/ApiFileRevert.php
===================================================================
--- trunk/phase3/includes/api/ApiFileRevert.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiFileRevert.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -101,14 +101,14 @@
// 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' );
}
}
Modified: trunk/phase3/includes/api/ApiImport.php
===================================================================
--- trunk/phase3/includes/api/ApiImport.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiImport.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -48,7 +48,7 @@
$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 @@
} else {
$isUpload = true;
if ( !$wgUser->isAllowed( 'importupload' ) ) {
- $this->dieUsageMsg( array( 'cantimport-upload'
) );
+ $this->dieUsageMsg( 'cantimport-upload' );
}
$source = ImportStreamSource::newFromUpload( 'xml' );
}
Modified: trunk/phase3/includes/api/ApiMain.php
===================================================================
--- trunk/phase3/includes/api/ApiMain.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiMain.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -568,7 +568,7 @@
} else {
global $wgUser;
if ( !$wgUser->matchEditToken(
$moduleParams['token'], $salt, $this->getMain()->getRequest() ) ) {
- $this->dieUsageMsg( array(
'sessionfailure' ) );
+ $this->dieUsageMsg( 'sessionfailure' );
}
}
}
@@ -611,14 +611,14 @@
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();
Modified: trunk/phase3/includes/api/ApiMove.php
===================================================================
--- trunk/phase3/includes/api/ApiMove.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiMove.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -61,7 +61,7 @@
}
if ( !$fromTitle->exists() ) {
- $this->dieUsageMsg( array( 'notanarticle' ) );
+ $this->dieUsageMsg( 'notanarticle' );
}
$fromTalk = $fromTitle->getTalkPage();
@@ -76,9 +76,9 @@
&& 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'
);
}
}
Modified: trunk/phase3/includes/api/ApiProtect.php
===================================================================
--- trunk/phase3/includes/api/ApiProtect.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiProtect.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -73,10 +73,10 @@
$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' ) {
Modified: trunk/phase3/includes/api/ApiQueryCategories.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategories.php 2011-05-19 17:31:32 UTC
(rev 88415)
+++ trunk/phase3/includes/api/ApiQueryCategories.php 2011-05-19 17:51:16 UTC
(rev 88416)
@@ -104,7 +104,7 @@
}
if ( isset( $show['hidden'] ) && isset( $show['!hidden'] ) ) {
- $this->dieUsageMsg( array( 'show' ) );
+ $this->dieUsageMsg( 'show' );
}
if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) ||
isset( $prop['hidden'] ) )
{
Modified: trunk/phase3/includes/api/ApiQueryQueryPage.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryQueryPage.php 2011-05-19 17:31:32 UTC
(rev 88415)
+++ trunk/phase3/includes/api/ApiQueryQueryPage.php 2011-05-19 17:51:16 UTC
(rev 88416)
@@ -82,7 +82,7 @@
$qp = new $this->qpMap[$params['page']]();
if ( !$qp->userCanExecute( $wgUser ) ) {
- $this->dieUsageMsg( array( 'specialpage-cantexecute' )
);
+ $this->dieUsageMsg( 'specialpage-cantexecute' );
}
$r = array( 'name' => $params['page'] );
Modified: trunk/phase3/includes/api/ApiQueryRecentChanges.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryRecentChanges.php 2011-05-19 17:31:32 UTC
(rev 88415)
+++ trunk/phase3/includes/api/ApiQueryRecentChanges.php 2011-05-19 17:51:16 UTC
(rev 88416)
@@ -158,7 +158,7 @@
|| ( isset( $show['redirect'] ) &&
isset( $show['!redirect'] ) )
|| ( isset( $show['patrolled'] ) &&
isset( $show['!patrolled'] ) )
) {
- $this->dieUsageMsg( array( 'show' ) );
+ $this->dieUsageMsg( 'show' );
}
// Check permissions
Modified: trunk/phase3/includes/api/ApiQueryUserContributions.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryUserContributions.php 2011-05-19
17:31:32 UTC (rev 88415)
+++ trunk/phase3/includes/api/ApiQueryUserContributions.php 2011-05-19
17:51:16 UTC (rev 88416)
@@ -189,7 +189,7 @@
$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'] ) );
Modified: trunk/phase3/includes/api/ApiQueryWatchlist.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryWatchlist.php 2011-05-19 17:31:32 UTC
(rev 88415)
+++ trunk/phase3/includes/api/ApiQueryWatchlist.php 2011-05-19 17:51:16 UTC
(rev 88416)
@@ -147,7 +147,7 @@
|| ( isset ( $show['patrolled'] ) &&
isset ( $show['!patrolled'] ) )
)
{
- $this->dieUsageMsg( array( 'show' ) );
+ $this->dieUsageMsg( 'show' );
}
// Check permissions.
Modified: trunk/phase3/includes/api/ApiQueryWatchlistRaw.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryWatchlistRaw.php 2011-05-19 17:31:32 UTC
(rev 88415)
+++ trunk/phase3/includes/api/ApiQueryWatchlistRaw.php 2011-05-19 17:51:16 UTC
(rev 88416)
@@ -63,7 +63,7 @@
$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 @@
public function getVersion() {
return __CLASS__ . ': $Id$';
}
-}
\ No newline at end of file
+}
Modified: trunk/phase3/includes/api/ApiRollback.php
===================================================================
--- trunk/phase3/includes/api/ApiRollback.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiRollback.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -178,7 +178,7 @@
$this->dieUsageMsg( array( 'invalidtitle',
$params['title'] ) );
}
if ( !$this->mTitleObj->exists() ) {
- $this->dieUsageMsg( array( 'notanarticle' ) );
+ $this->dieUsageMsg( 'notanarticle' );
}
return $this->mTitleObj;
Modified: trunk/phase3/includes/api/ApiUnblock.php
===================================================================
--- trunk/phase3/includes/api/ApiUnblock.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiUnblock.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -55,20 +55,20 @@
}
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 );
}
}
Modified: trunk/phase3/includes/api/ApiUndelete.php
===================================================================
--- trunk/phase3/includes/api/ApiUndelete.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiUndelete.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -43,11 +43,11 @@
$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 @@
$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] ) {
Modified: trunk/phase3/includes/api/ApiUpload.php
===================================================================
--- trunk/phase3/includes/api/ApiUpload.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiUpload.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -50,7 +50,7 @@
// Check whether upload is enabled
if ( !UploadBase::isEnabled() ) {
- $this->dieUsageMsg( array( 'uploaddisabled' ) );
+ $this->dieUsageMsg( 'uploaddisabled' );
}
// Parameter handling
@@ -208,7 +208,7 @@
// 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 @@
} 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 @@
if ( !$user->isLoggedIn() ) {
$this->dieUsageMsg( array( 'mustbeloggedin',
'upload' ) );
} else {
- $this->dieUsageMsg( array( 'badaccess-groups' )
);
+ $this->dieUsageMsg( 'badaccess-groups' );
}
}
}
Modified: trunk/phase3/includes/api/ApiWatch.php
===================================================================
--- trunk/phase3/includes/api/ApiWatch.php 2011-05-19 17:31:32 UTC (rev
88415)
+++ trunk/phase3/includes/api/ApiWatch.php 2011-05-19 17:51:16 UTC (rev
88416)
@@ -66,7 +66,7 @@
$success = Action::factory( 'watch', $article
)->execute();
}
if ( !$success ) {
- $this->dieUsageMsg( array( 'hookaborted' ) );
+ $this->dieUsageMsg( 'hookaborted' );
}
$this->getResult()->addValue( null, $this->getModuleName(),
$res );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs