From 06166e334a6e454ff73d4a62184d41a556dd0ca2 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 18 Jul 2012 19:24:38 +0200 Subject: [PATCH] (bug 38190) Add "required" flag to some token params action=block/action=unblock can not have the token required because when using the gettoken param, the token param can not set. Change-Id: I15317f16c06f150d29c1b17de76f41a6cfa84820 --- RELEASE-NOTES-1.20 | 1 + includes/api/ApiDelete.php | 5 ++++- includes/api/ApiEditPage.php | 5 ++++- includes/api/ApiEmailUser.php | 5 ++++- includes/api/ApiFileRevert.php | 5 ++++- includes/api/ApiImport.php | 5 ++++- includes/api/ApiMove.php | 5 ++++- includes/api/ApiPatrol.php | 5 ++++- includes/api/ApiProtect.php | 5 ++++- includes/api/ApiRollback.php | 5 ++++- includes/api/ApiUndelete.php | 5 ++++- includes/api/ApiUpload.php | 5 ++++- includes/api/ApiUserrights.php | 5 ++++- includes/api/ApiWatch.php | 5 ++++- 14 files changed, 53 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index fcbb5311b0..1c15cf0b1e 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -195,6 +195,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * (bug 29290) API avoids mangling fields in continuation parameters * (bug 36987) API avoids mangling fields in continuation parameters * (bug 30836) siteinfo prop=specialpagealiases will no longer return nonexistent special pages +* (bug 38190) Add "required" flag to some token params for hint in api docs. === Languages updated in 1.20 === diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index b5079a2813..5932c72417 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -180,7 +180,10 @@ class ApiDelete extends ApiBase { 'pageid' => array( ApiBase::PARAM_TYPE => 'integer' ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'reason' => null, 'watch' => array( ApiBase::PARAM_DFLT => false, diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index ff0e0a83d9..e75c4ad7c5 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -413,7 +413,10 @@ class ApiEditPage extends ApiBase { ApiBase::PARAM_REQUIRED => false, ), 'text' => null, - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'summary' => null, 'minor' => false, 'notminor' => false, diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 4b6ba00dc4..4fa034341c 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -98,7 +98,10 @@ class ApiEmailUser extends ApiBase { ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'ccme' => false, ); } diff --git a/includes/api/ApiFileRevert.php b/includes/api/ApiFileRevert.php index 7cac0eb47c..08a9c8e58c 100644 --- a/includes/api/ApiFileRevert.php +++ b/includes/api/ApiFileRevert.php @@ -126,7 +126,10 @@ class ApiFileRevert extends ApiBase { ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), ); } diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 15eac33d48..abd2777189 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -98,7 +98,10 @@ class ApiImport extends ApiBase { public function getAllowedParams() { global $wgImportSources; return array( - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'summary' => null, 'xml' => null, 'interwikisource' => array( diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 1fd81ab877..55148b1886 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -177,7 +177,10 @@ class ApiMove extends ApiBase { ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'reason' => '', 'movetalk' => false, 'movesubpages' => false, diff --git a/includes/api/ApiPatrol.php b/includes/api/ApiPatrol.php index 45d19d0d33..cb5e081ad6 100644 --- a/includes/api/ApiPatrol.php +++ b/includes/api/ApiPatrol.php @@ -65,7 +65,10 @@ class ApiPatrol extends ApiBase { public function getAllowedParams() { return array( - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'rcid' => array( ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_REQUIRED => true diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index e763fd5229..d516504393 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -139,7 +139,10 @@ class ApiProtect extends ApiBase { 'pageid' => array( ApiBase::PARAM_TYPE => 'integer', ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'protections' => array( ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_REQUIRED => true, diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index dddbb852d7..677df16a9b 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -90,7 +90,10 @@ class ApiRollback extends ApiBase { ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'summary' => '', 'markbot' => false, 'watchlist' => array( diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index ffecc0ef7a..c9962517e2 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -94,7 +94,10 @@ class ApiUndelete extends ApiBase { ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'reason' => '', 'timestamps' => array( ApiBase::PARAM_TYPE => 'timestamp', diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index aaa4c85dd8..31b4351093 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -560,7 +560,10 @@ class ApiUpload extends ApiBase { ApiBase::PARAM_DFLT => '' ), 'text' => null, - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'watch' => array( ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true, diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index c664398f85..cbb66a4159 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -100,7 +100,10 @@ class ApiUserrights extends ApiBase { ApiBase::PARAM_TYPE => User::getAllGroups(), ApiBase::PARAM_ISMULTI => true ), - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'reason' => array( ApiBase::PARAM_DFLT => '' ) diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 3801aecc72..0509f1f8f4 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -88,7 +88,10 @@ class ApiWatch extends ApiBase { ApiBase::PARAM_REQUIRED => true ), 'unwatch' => false, - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), ); } -- 2.20.1