Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108315


Change subject: treat true as empty string, skip false in xml format
......................................................................

treat true as empty string, skip false in xml format

The xml format gives a empty attribute to indicate a true, for example
top="" or anon="". The new meta=filerepoinfo module gives natural
booleans to the xml formatter, which than will converted to strings,
that gives a empty attribute for false and a attribute with the value
"1" for true attributes. Change this behaviour in xml formatter to allow
the natural booleans on the other formats like json, which support that
better than xml.

Bug: 59953
Change-Id: Iedf43aae2e624e8e15c9cf102d24b8365110164a
---
M includes/api/ApiFormatXml.php
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/108315/1

diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php
index e707eb4..764e609 100644
--- a/includes/api/ApiFormatXml.php
+++ b/includes/api/ApiFormatXml.php
@@ -156,6 +156,13 @@
                                } elseif ( is_array( $subElemValue ) ) {
                                        $subElements[$subElemId] = 
$subElemValue;
                                        unset( $elemValue[$subElemId] );
+                               } elseif ( is_bool( $subElemValue ) ) {
+                                       // treat true as empty string, skip 
false in xml format
+                                       if ( $subElemValue === true ) {
+                                               $subElemValue = '';
+                                       } else {
+                                               unset( $elemValue[$subElemId] );
+                                       }
                                }
                        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iedf43aae2e624e8e15c9cf102d24b8365110164a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>

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

Reply via email to