jenkins-bot has submitted this change and it was merged.
Change subject: Set "list" fields to be displayed as lists in JSON format
......................................................................
Set "list" fields to be displayed as lists in JSON format
Change-Id: I0450c131b2cdab834ccf11dedbf2c11c027043ad
---
M specials/CargoExport.php
1 file changed, 14 insertions(+), 0 deletions(-)
Approvals:
Yaron Koren: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/specials/CargoExport.php b/specials/CargoExport.php
index aeba680..c12b7e9 100644
--- a/specials/CargoExport.php
+++ b/specials/CargoExport.php
@@ -308,6 +308,20 @@
$allQueryResults = array();
foreach ( $sqlQueries as $sqlQuery ) {
$queryResults = $sqlQuery->run();
+
+ // Turn "List" fields into arrays.
+ foreach ( $sqlQuery->mFieldDescriptions as $alias =>
$fieldDescription ) {
+ if ( $fieldDescription->mIsList ) {
+ $delimiter =
$fieldDescription->mDelimiter;
+ for ( $i = 0; $i < count( $queryResults
); $i++ ) {
+ $curValue =
$queryResults[$i][$alias];
+ if ( !is_array( $curValue ) ) {
+
$queryResults[$i][$alias] = explode( $delimiter, $curValue );
+ }
+ }
+ }
+ }
+
$allQueryResults = array_merge( $allQueryResults,
$queryResults );
}
print json_encode( $allQueryResults, JSON_NUMERIC_CHECK |
JSON_HEX_TAG | JSON_PRETTY_PRINT );
--
To view, visit https://gerrit.wikimedia.org/r/220936
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0450c131b2cdab834ccf11dedbf2c11c027043ad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits