Addshore has uploaded a new change for review.
https://gerrit.wikimedia.org/r/226643
Change subject: WIP Remove ungroupedlist api parameters
......................................................................
WIP Remove ungroupedlist api parameters
This should not be merged until after
the 1.26wmf16 branch
After Mon, 27 July
Change-Id: I10b424b8c31996d8de4c63ae1c9482689c07cebb
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/api/GetClaims.php
M repo/includes/api/GetEntities.php
M repo/tests/phpunit/includes/api/GetClaimsTest.php
M repo/tests/phpunit/includes/api/GetEntitiesTest.php
6 files changed, 6 insertions(+), 67 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/43/226643/1
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 53133fe..30421da 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -502,7 +502,6 @@
"apihelp-wbgetclaims-param-claim": "A GUID identifying the claim.
Required unless entity is provided. The GUID is the globally unique identifier
for a claim, e.g. \"q42$D8404CDA-25E4-4334-AF13-A3290BCD9C0F\".",
"apihelp-wbgetclaims-param-rank": "Optional filter to return only the
claims that have the specified rank",
"apihelp-wbgetclaims-param-props": "Some parts of the claim are
returned optionally. This parameter controls which ones are returned.",
- "apihelp-wbgetclaims-param-ungroupedlist": "Do not group snaks by
property ID",
"apihelp-wbgetclaims-example-1": "Get claims for item with ID Q42",
"apihelp-wbgetclaims-example-2": "Get claims for item with ID Q42 and
property with ID P2",
"apihelp-wbgetclaims-example-3": "Get claims for item with ID Q42 that
are ranked as normal",
@@ -516,7 +515,6 @@
"apihelp-wbgetentities-param-languages": "By default the
internationalized values are returned in all available languages.\nThis
parameter allows filtering these down to one or more languages by providing one
or more language codes.",
"apihelp-wbgetentities-param-languagefallback": "Apply language
fallback for languages defined in the \"languages\" parameter, with the current
context of API call.",
"apihelp-wbgetentities-param-normalize": "Try to normalize the page
title against the client site.\nThis only works if exactly one site and one
page have been given.",
- "apihelp-wbgetentities-param-ungroupedlist": "Do not group snaks by
property ID.",
"apihelp-wbgetentities-param-sitefilter": "Filter sitelinks in entities
to those with these siteids.",
"apihelp-wbgetentities-example-1": "Get entities with ID Q42 with all
available attributes in all available languages",
"apihelp-wbgetentities-example-2": "Get entities with ID P17 with all
available attributes in all available languages",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index f52dc12..2cd9e5e 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -530,7 +530,6 @@
"apihelp-wbgetclaims-param-claim":
"{{doc-apihelp-param|wbgetclaims|claim}}",
"apihelp-wbgetclaims-param-rank":
"{{doc-apihelp-param|wbgetclaims|rank}}",
"apihelp-wbgetclaims-param-props":
"{{doc-apihelp-param|wbgetclaims|props}}",
- "apihelp-wbgetclaims-param-ungroupedlist":
"{{doc-apihelp-param|wbgetclaims|ungroupedlist}}",
"apihelp-wbgetclaims-example-1": "{{doc-apihelp-example|wbgetclaims}}",
"apihelp-wbgetclaims-example-2": "{{doc-apihelp-example|wbgetclaims}}",
"apihelp-wbgetclaims-example-3": "{{doc-apihelp-example|wbgetclaims}}",
@@ -544,7 +543,6 @@
"apihelp-wbgetentities-param-languages":
"{{doc-apihelp-param|wbgetentities|languages}}",
"apihelp-wbgetentities-param-languagefallback":
"{{doc-apihelp-param|wbgetentities|languagefallback}}",
"apihelp-wbgetentities-param-normalize":
"{{doc-apihelp-param|wbgetentities|normalize}}",
- "apihelp-wbgetentities-param-ungroupedlist":
"{{doc-apihelp-param|wbgetentities|ungroupedlist}}",
"apihelp-wbgetentities-param-sitefilter":
"{{doc-apihelp-param|wbgetentities|sitefilter}}",
"apihelp-wbgetentities-example-1":
"{{doc-apihelp-example|wbgetentities}}",
"apihelp-wbgetentities-example-2":
"{{doc-apihelp-example|wbgetentities}}",
diff --git a/repo/includes/api/GetClaims.php b/repo/includes/api/GetClaims.php
index d87331c..0211b6d 100644
--- a/repo/includes/api/GetClaims.php
+++ b/repo/includes/api/GetClaims.php
@@ -104,15 +104,6 @@
);
$entity = $entityRevision->getEntity();
- if ( $params['ungroupedlist'] ) {
- $this->logFeatureUsage(
'action=wbgetclaims&ungroupedlist' );
- $this->resultBuilder->getOptions()
- ->setOption(
-
SerializationOptions::OPT_GROUP_BY_PROPERTIES,
- array()
- );
- }
-
$claims = $this->getClaims( $entity, $guid );
$this->resultBuilder->addClaims( $claims, null );
}
@@ -254,11 +245,6 @@
'references',
),
self::PARAM_DFLT => 'references',
- ),
- 'ungroupedlist' => array(
- self::PARAM_TYPE => 'boolean',
- self::PARAM_DFLT => false,
- self::PARAM_DEPRECATED => true,
),
);
}
diff --git a/repo/includes/api/GetEntities.php
b/repo/includes/api/GetEntities.php
index 294ffc0..3e34cb2 100644
--- a/repo/includes/api/GetEntities.php
+++ b/repo/includes/api/GetEntities.php
@@ -307,13 +307,6 @@
} else {
$languages = $params['languages'];
}
- if ( $params['ungroupedlist'] ) {
- $this->logFeatureUsage(
'action=wbgetentities&ungroupedlist' );
- $options->setOption(
-
SerializationOptions::OPT_GROUP_BY_PROPERTIES,
- array()
- );
- }
$options->setLanguages( $languages );
$options->setOption( EntitySerializer::OPT_SORT_ORDER,
EntitySerializer::SORT_ASC );
$options->setOption( EntitySerializer::OPT_PARTS, $props );
@@ -363,11 +356,6 @@
'normalize' => array(
self::PARAM_TYPE => 'boolean',
self::PARAM_DFLT => false
- ),
- 'ungroupedlist' => array(
- self::PARAM_TYPE => 'boolean',
- self::PARAM_DFLT => false,
- self::PARAM_DEPRECATED => true,
),
'sitefilter' => array(
self::PARAM_TYPE =>
$sites->getGlobalIdentifiers(),
diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php
b/repo/tests/phpunit/includes/api/GetClaimsTest.php
index 3a565e2..acb9dca 100644
--- a/repo/tests/phpunit/includes/api/GetClaimsTest.php
+++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php
@@ -124,17 +124,14 @@
'entity' => $idSerialization,
);
- $argLists[] = array( $params, $statements->toArray(),
true );
+ $argLists[] = array( $params, $statements->toArray() );
foreach ( $statements->toArray() as $statement ) {
$params = array(
'action' => 'wbgetclaims',
'claim' => $statement->getGuid(),
);
- $argLists[] = array( $params, array( $statement
), true );
-
- $params['ungroupedlist'] = true;
- $argLists[] = array( $params, array( $statement
), false );
+ $argLists[] = array( $params, array( $statement
) );
}
foreach ( array( Statement::RANK_DEPRECATED,
Statement::RANK_NORMAL, Statement::RANK_PREFERRED ) as $rank ) {
@@ -145,7 +142,7 @@
);
$statementsByRank = $statements->getByRank(
$rank )->toArray();
- $argLists[] = array( $params,
$statementsByRank, true );
+ $argLists[] = array( $params, $statementsByRank
);
}
}
@@ -154,23 +151,19 @@
public function testValidRequests() {
foreach ( $this->validRequestProvider() as $argList ) {
- list( $params, $statements, $groupedByProperty ) =
$argList;
+ list( $params, $statements ) = $argList;
- $this->doTestValidRequest( $params, $statements,
$groupedByProperty );
+ $this->doTestValidRequest( $params, $statements );
}
}
/**
* @param string[] $params
* @param Statement[] $statements
- * @param bool $groupedByProperty
*/
- public function doTestValidRequest( array $params, array $statements,
$groupedByProperty ) {
+ public function doTestValidRequest( array $params, array $statements ) {
$claims = new Claims( $statements );
$options = new SerializationOptions();
- if ( !$groupedByProperty ) {
- $options->setOption(
SerializationOptions::OPT_GROUP_BY_PROPERTIES, array() );
- }
$serializerFactory = new LibSerializerFactory( null,
$this->getDataTypeLookup() );
$serializer = $serializerFactory->newClaimsSerializer( $options
);
diff --git a/repo/tests/phpunit/includes/api/GetEntitiesTest.php
b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
index 9cfbd12..494eb19 100644
--- a/repo/tests/phpunit/includes/api/GetEntitiesTest.php
+++ b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
@@ -142,11 +142,6 @@
foreach ( self::$goodItems as $testCase ) {
$testCase['p']['props'] = $propData;
$testCases[] = $testCase;
-
- if ( in_array( 'claims', explode( '|',
$propData ) ) ) {
- $testCase['p']['ungroupedlist'] = true;
- $testCases[] = $testCase;
- }
}
}
@@ -262,13 +257,6 @@
} else {
$expected['dir'] = 'ascending';
}
-
- //expect snaks to be grouped by property or not
- if( !isset( $params['ungroupedlist'] ) ||
!$params['ungroupedlist'] ) {
- $expected['groupedbyproperty'] = true;
- } else {
- $expected['groupedbyproperty'] = false;
- }
return $expected;
}
@@ -296,18 +284,6 @@
$expected['props'],
$expected['languages']
);
- if( !$expected['groupedbyproperty'] ) {
- $options = new SerializationOptions();
- $options->setOption(
SerializationOptions::OPT_GROUP_BY_PROPERTIES, array() );
- $factory = new LibSerializerFactory();
- /** @var EntitySerializer $serializer */
- $serializer = $factory->newSerializerForEntity(
$entity['type'], $options );
- $expectedEntityOutput = $serializer->getSerialized(
- $serializer->newFromSerialization(
- $expectedEntityOutput
- )
- );
- }
$this->assertEntityEquals(
$expectedEntityOutput,
$entity,
--
To view, visit https://gerrit.wikimedia.org/r/226643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I10b424b8c31996d8de4c63ae1c9482689c07cebb
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