Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/208121
Change subject: Add fixes indicating bad assumptions on entity id format
......................................................................
Add fixes indicating bad assumptions on entity id format
Change-Id: I36bc0f48b2efce6855c8027875b0e19409adcaba
---
M lib/includes/store/sql/SqlEntityInfoBuilder.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/includes/store/sql/WikiPageEntityMetaDataLookup.php
3 files changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/21/208121/1
diff --git a/lib/includes/store/sql/SqlEntityInfoBuilder.php
b/lib/includes/store/sql/SqlEntityInfoBuilder.php
index a811ca7..2964662 100644
--- a/lib/includes/store/sql/SqlEntityInfoBuilder.php
+++ b/lib/includes/store/sql/SqlEntityInfoBuilder.php
@@ -275,6 +275,7 @@
$this->entityIds[$key] = $id;
$this->entityInfo[$key]['id'] = $key;
+ // FIXME: this will fail for IDs that do not have a numeric form
$this->numericIdsByType[$type][$key] = $id->getNumericId();
}
diff --git a/lib/includes/store/sql/TermSqlIndex.php
b/lib/includes/store/sql/TermSqlIndex.php
index 38fa5d2..2868fa7 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -261,6 +261,7 @@
// That would allow us to do the deletion in a single
query, based on a set of ids.
$entityIdentifiers = array(
+ // FIXME: this will fail for IDs that do not have a
numeric form
'term_entity_id' => $entityId->getNumericId(),
'term_entity_type' => $entityId->getEntityType()
);
@@ -355,6 +356,7 @@
$success = $dbw->delete(
$this->tableName,
array(
+ // FIXME: this will fail for IDs that do not
have a numeric form
'term_entity_id' => $entityId->getNumericId(),
'term_entity_type' => $entityId->getEntityType()
),
@@ -443,6 +445,7 @@
throw new MWException( "ID $id does not refer
to an entity of type $entityType" );
}
+ // FIXME: this will fail for IDs that do not have a
numeric form
$numericIds[] = $id->getNumericId();
}
diff --git a/lib/includes/store/sql/WikiPageEntityMetaDataLookup.php
b/lib/includes/store/sql/WikiPageEntityMetaDataLookup.php
index 29e5e55..1841a24 100644
--- a/lib/includes/store/sql/WikiPageEntityMetaDataLookup.php
+++ b/lib/includes/store/sql/WikiPageEntityMetaDataLookup.php
@@ -204,6 +204,7 @@
foreach ( $entityIds as $entityId ) {
$result[$entityId->getSerialization()] = false;
+ // FIXME: this will fail for IDs that do not have a
numeric form
$key = $entityId->getEntityType() .
$entityId->getNumericId();
if ( isset( $rows[$key] ) ) {
$result[$entityId->getSerialization()] =
$rows[$key];
@@ -224,6 +225,7 @@
foreach ( $entityIds as &$entityId ) {
$where[] = $db->makeList( array(
+ // FIXME: this will fail for IDs that do not
have a numeric form
'epp_entity_id' => $entityId->getNumericId(),
'epp_entity_type' => $entityId->getEntityType()
), LIST_AND );
--
To view, visit https://gerrit.wikimedia.org/r/208121
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36bc0f48b2efce6855c8027875b0e19409adcaba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits