Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385403 )

Change subject: Fix for bcadef37f8d7 for list and coordinate fields
......................................................................

Fix for bcadef37f8d7 for list and coordinate fields

Change-Id: Idfda7ead91f73be168cb91d753c140cc9b6e4b8e
---
M parserfunctions/CargoStore.php
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/03/385403/2

diff --git a/parserfunctions/CargoStore.php b/parserfunctions/CargoStore.php
index a9639cc..3109714 100644
--- a/parserfunctions/CargoStore.php
+++ b/parserfunctions/CargoStore.php
@@ -288,7 +288,18 @@
                // a very rare case, while unwanted code duplication is
                // unfortunately a common case. So until there's a real
                // solution, this workaround will be helpful.
-               $res = $cdb->select( $tableName, 'COUNT(*)', $tableFieldValues 
);
+               $tableFieldValuesForCheck = array();
+               foreach ( $tableSchema->mFieldDescriptions as $fieldName => 
$fieldDescription ) {
+                       if ( ! array_key_exists( $fieldName, $tableFieldValues 
) ) {
+                               continue;
+                       }
+                       if ( $fieldDescription->mIsList || 
$fieldDescription->mType == 'Coordinates' ) {
+                               $tableFieldValuesForCheck[$fieldName . 
'__full'] = $tableFieldValues[$fieldName];
+                       } else {
+                               $tableFieldValuesForCheck[$fieldName] = 
$tableFieldValues[$fieldName];
+                       }
+               }
+               $res = $cdb->select( $tableName, 'COUNT(*)', 
$tableFieldValuesForCheck );
                $row = $cdb->fetchRow( $res );
                if ( $row[0] > 0 ) {
                        $cdb->close();

-- 
To view, visit https://gerrit.wikimedia.org/r/385403
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfda7ead91f73be168cb91d753c140cc9b6e4b8e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to