jenkins-bot has submitted this change and it was merged.
Change subject: Move wbgetclaims validation to validateParameters
......................................................................
Move wbgetclaims validation to validateParameters
Change-Id: I7545e0cda88989dd98e85f0b645d3170c0334dc7
---
M repo/includes/api/GetClaims.php
1 file changed, 14 insertions(+), 7 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/api/GetClaims.php b/repo/includes/api/GetClaims.php
index 68ca8cc..0bba4a1 100644
--- a/repo/includes/api/GetClaims.php
+++ b/repo/includes/api/GetClaims.php
@@ -61,7 +61,10 @@
//@todo validate
//@todo check permissions
- list( $id, $claimGuid ) = $this->getIdentifiers();
+ $params = $this->extractRequestParams();
+ $this->validateParameters( $params );
+
+ list( $id, $claimGuid ) = $this->getIdentifiers( $params );
$entityId = EntityId::newFromPrefixedId( $id );
$entity = $entityId ? $this->getEntity( $entityId ) : null;
@@ -75,8 +78,15 @@
wfProfileOut( __METHOD__ );
}
+ protected function validateParameters( array $params ) {
+ if ( !isset( $params['entity'] ) && !isset( $params['claim'] )
) {
+ $this->dieUsage( 'Either the entity parameter or the
claim parameter need to be set', 'param-missing' );
+ }
+ }
+
/**
* @see \ApiBase::getPossibleErrors()
+ * @return array
*/
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
@@ -89,6 +99,7 @@
/**
* @since 0.3
*
+ * @param array $claims
* @param \Wikibase\Claim[] $claims
*/
protected function outputClaims( array $claims ) {
@@ -171,16 +182,12 @@
*
* @since 0.3
*
+ * @param $params
* @return array
* First element is a prefixed entity id
* Second element is either null or a claim GUID
*/
- protected function getIdentifiers() {
- $params = $this->extractRequestParams();
-
- if ( !isset( $params['entity'] ) && !isset( $params['claim'] )
) {
- $this->dieUsage( 'Either the entity parameter or the
key parameter need to be set', 'param-missing' );
- }
+ protected function getIdentifiers( $params ) {
$claimGuid = null;
--
To view, visit https://gerrit.wikimedia.org/r/73742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7545e0cda88989dd98e85f0b645d3170c0334dc7
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Anja Jentzsch <[email protected]>
Gerrit-Reviewer: Ataherivand <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: Henning Snater <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jens Ohlig <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: John Erling Blad <[email protected]>
Gerrit-Reviewer: Liangent <[email protected]>
Gerrit-Reviewer: Lydia Pintscher <[email protected]>
Gerrit-Reviewer: Markus Kroetzsch <[email protected]>
Gerrit-Reviewer: Nikola Smolenski <[email protected]>
Gerrit-Reviewer: Nilesh <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits