From: Sam Reed Date: Sat, 13 Feb 2010 00:28:27 +0000 (+0000) Subject: Rest of dieUsageMsg in getPossibleErrors X-Git-Tag: 1.31.0-rc.0~37794 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=2081a0693fdad9f99e0cb17c94edf0cddbc353a6;p=lhc%2Fweb%2Fwiklou.git Rest of dieUsageMsg in getPossibleErrors --- diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 5efdcfcbd6..af64a2fb03 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -209,6 +209,16 @@ class ApiDelete extends ApiBase { 'Delete a page.' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'token' ), + array( 'invalidtitle', 'title' ), + array( 'nosuchpageid', 'pageid' ), + array( 'notanarticle' ), + array( 'hookaborted', 'error' ), + ) ); + } protected function getExamples() { return array ( @@ -220,4 +230,4 @@ class ApiDelete extends ApiBase { public function getVersion() { return __CLASS__ . ': $Id$'; } -} +} \ No newline at end of file diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index a0978d751a..9a9b597f5f 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -345,6 +345,46 @@ class ApiEditPage extends ApiBase { protected function getDescription() { return 'Create and edit pages.'; } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'title' ), + array( 'missingtext' ), + array( 'missingparam', 'token' ), + array( 'sessionfailure' ), + array( 'invalidtitle', 'title' ), + array( 'createonly-exists' ), + array( 'nocreate-missing' ), + array( 'nosuchrevid', 'undo' ), + array( 'nosuchrevid', 'undoafter' ), + array( 'revwrongpage', 'id', 'text' ), + array( 'revwrongpage', 'id', 'text' ), + array( 'undo-failure' ), + array( 'hashcheckfailed' ), + array( 'hookaborted' ), + array( 'hookaborted' ), + array( 'noimageredirect-anon' ), + array( 'noimageredirect-logged' ), + array( 'spamdetected', 'spam' ), + array( 'filtered' ), + array( 'blockedtext' ), + array( 'contenttoobig', $this->getMaxArticleSize() ), + array( 'noedit-anon' ), + array( 'noedit' ), + array( 'actionthrottledtext' ), + array( 'wasdeleted' ), + array( 'nocreate-loggedin' ), + array( 'blankpage' ), + array( 'editconflict' ), + array( 'emptynewsection' ), + array( 'unknownerror', 'retval' ), + ) ); + } + + private function getMaxArticleSize() { + global $wgMaxArticleSize; + return $wgMaxArticleSize; + } protected function getAllowedParams() { return array ( diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 308f229ff8..a96fc31e47 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -116,7 +116,6 @@ class ApiFeedWatchlist extends ApiBase { $feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss'; $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); - if ( $e instanceof UsageException ) { $errorCode = $e->getCodeString(); } else { diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index a57217f521..c2b2f25caf 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -140,6 +140,18 @@ class ApiImport extends ApiBase { 'Import a page from another wiki, or an XML file' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'cantimport' ), + array( 'missingparam', 'token' ), + array( 'sessionfailure' ), + array( 'missingparam', 'interwikipage' ), + array( 'cantimport-upload' ), + array( 'import-unknownerror', 'source' ), + array( 'import-unknownerror', 'result' ), + ) ); + } protected function getExamples() { return array( @@ -176,4 +188,4 @@ class ApiImportReporter extends ImportReporter { { return $this->mResultArr; } -} +} \ No newline at end of file diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index e1ba722699..b9d41fba52 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -209,6 +209,19 @@ class ApiMove extends ApiBase { 'Move a page.' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'to' ), + array( 'missingparam', 'token' ), + array( 'sessionfailure' ), + array( 'invalidtitle', 'from' ), + array( 'nosuchpageid', 'fromid' ), + array( 'notanarticle' ), + array( 'invalidtitle', 'to' ), + array( 'sharedfile-exists' ), + ) ); + } protected function getExamples() { return array ( diff --git a/includes/api/ApiPatrol.php b/includes/api/ApiPatrol.php index 462593faec..bd97c0a811 100644 --- a/includes/api/ApiPatrol.php +++ b/includes/api/ApiPatrol.php @@ -89,6 +89,15 @@ class ApiPatrol extends ApiBase { 'Patrol a page or revision. ' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'token' ), + array( 'missingparam', 'rcid' ), + array( 'sessionfailure' ), + array( 'nosuchrcid', 'rcid' ), + ) ); + } protected function getExamples() { return array( @@ -99,4 +108,4 @@ class ApiPatrol extends ApiBase { public function getVersion() { return __CLASS__ . ': $Id$'; } -} +} \ No newline at end of file diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 2253dc91e1..34283f295f 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -171,6 +171,23 @@ class ApiProtect extends ApiBase { 'Change the protection level of a page.' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'title' ), + array( 'missingparam', 'token' ), + array( 'missingparam', 'protections' ), + array( 'sessionfailure' ), + array( 'invalidtitle', 'title' ), + array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ) ), + array( 'create-titleexists' ), + array( 'missingtitle-createonly' ), + array( 'protect-invalidaction', 'action'] ), + array( 'protect-invalidlevel', 'level' ), + array( 'invalidexpiry', 'expiry' ), + array( 'pastexpiry', 'expiry' ), + ) ); + } protected function getExamples() { return array ( diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 49f30ba579..2a76544741 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -453,6 +453,13 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { ApiBase :: dieDebug( __METHOD__, 'Unknown module name' ); } } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'invalidtitle', 'title' ), + array( 'missingparam', 'title' ), + ) ); + } protected function getExamples() { static $examples = array ( diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index d44a2f303f..252d25ed07 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -407,6 +407,13 @@ abstract class ApiQueryBase extends ApiBase { public function keyPartToTitle( $keyPart ) { return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'invalidtitle', 'title' ), + array( 'invalidtitle', 'key' ), + ) ); + } /** * Get version string for use in the API help output diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index bf2b2ba2d4..29be3caf11 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -560,6 +560,12 @@ class ApiQueryRevisions extends ApiQueryBase { 'All parameters marked as (enum) may only be used with a single page (#2).' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'nosuchrevid', 'diffto' ), + ) ); + } protected function getExamples() { return array ( diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 3e8ea31627..cc9c470adc 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -113,6 +113,17 @@ class ApiRollback extends ApiBase { 'they will all be rolled back.' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'title' ), + array( 'missingparam', 'user' ), + array( 'missingparam', 'token' ), + array( 'invalidtitle', 'title' ), + array( 'notanarticle' ), + array( 'invaliduser', 'user' ), + ) ); + } protected function getExamples() { return array ( diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index a0e6e9b5a2..d594d1ffe7 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -117,6 +117,18 @@ class ApiUndelete extends ApiBase { 'retrieved through list=deletedrevs' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'missingparam', 'title' ), + array( 'missingparam', 'token' ), + array( 'permdenied-undelete' ), + array( 'blockedtext' ), + array( 'sessionfailure' ), + array( 'invalidtitle', 'title' ), + array( 'cannotundelete' ), + ) ); + } protected function getExamples() { return array ( diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 06d4a0128e..1c3688a0e6 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -91,6 +91,14 @@ class ApiWatch extends ApiBase { 'Add or remove a page from/to the current user\'s watchlist' ); } + + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ), + array( 'invalidtitle', 'title' ), + array( 'hookaborted' ), + ) ); + } protected function getExamples() { return array(