jenkins-bot has submitted this change and it was merged.
Change subject: Allow for both ids and sites/titles to be set for wbgetentities
......................................................................
Allow for both ids and sites/titles to be set for wbgetentities
Bug: 43309
Change-Id: I38bddcf3be55d5d8cf4fbdacb1cc73188ee79dd7
---
M repo/includes/api/GetEntities.php
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Aude: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/api/GetEntities.php
b/repo/includes/api/GetEntities.php
index 64ca636..0f2caec 100644
--- a/repo/includes/api/GetEntities.php
+++ b/repo/includes/api/GetEntities.php
@@ -57,16 +57,22 @@
$params = $this->extractRequestParams();
- if ( !( isset( $params['ids'] ) XOR ( !empty( $params['sites']
) && !empty( $params['titles'] ) ) ) ) {
+ if ( !isset( $params['ids'] ) && ( empty( $params['sites'] ) ||
empty( $params['titles'] ) ) ) {
wfProfileOut( __METHOD__ );
$this->dieUsage( 'Either provide the item "ids" or
pairs of "sites" and "titles" for corresponding pages', 'param-missing' );
}
if ( !isset( $params['ids'] ) ) {
+ // Since we merge into this, just create it
+ $params['ids'] = array();
+ }
+
+ if ( !empty( $params['sites'] ) ) {
$siteLinkCache =
StoreFactory::getStore()->newSiteLinkCache();
$siteStore = \SiteSQLStore::newInstance();
$itemByTitleHelper = new ItemByTitleHelper( $this,
$siteLinkCache, $siteStore, $this->stringNormalizer );
- $params['ids'] = $itemByTitleHelper->getEntityIds(
$params['sites'], $params['titles'], $params['normalize'] );
+ $otherIDs = $itemByTitleHelper->getEntityIds(
$params['sites'], $params['titles'], $params['normalize'] );
+ $params['ids'] = array_merge( $params['ids'], $otherIDs
);
}
$params['ids'] = $this->uniqueEntities( $params['ids'] );
--
To view, visit https://gerrit.wikimedia.org/r/80989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I38bddcf3be55d5d8cf4fbdacb1cc73188ee79dd7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.22-wmf14
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits