Addshore has uploaded a new change for review.
https://gerrit.wikimedia.org/r/73742
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/42/73742/1
diff --git a/repo/includes/api/GetClaims.php b/repo/includes/api/GetClaims.php
index 68ca8cc..fc457e8 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;
@@ -73,6 +76,15 @@
$this->outputClaims( $this->getClaims( $entity, $claimGuid ) );
wfProfileOut( __METHOD__ );
+ }
+
+ /**
+ * @see \Wikibase\Api\ModifyEntity::validateParameters()
+ */
+ protected function validateParameters( array $params ) {
+ if ( !isset( $params['entity'] ) && !isset( $params['claim'] )
) {
+ $this->dieUsage( 'Either the entity parameter or the
key parameter need to be set', 'param-missing' );
+ }
}
/**
@@ -175,12 +187,7 @@
* 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: newchange
Gerrit-Change-Id: I7545e0cda88989dd98e85f0b645d3170c0334dc7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits