Merge "Fixed detection of unsigned mysql column in updater"
[lhc/web/wiklou.git] / includes / api / ApiFormatXml.php
index 764e609..7010dd6 100644 (file)
@@ -111,9 +111,9 @@ class ApiFormatXml extends ApiFormatBase {
         * @note The method is recursive, so the same rules apply to any
         * sub-arrays.
         *
-        * @param $elemName
-        * @param $elemValue
-        * @param $indent
+        * @param string $elemName
+        * @param mixed $elemValue
+        * @param int $indent
         *
         * @return string
         */
@@ -147,6 +147,15 @@ class ApiFormatXml extends ApiFormatBase {
                                $subElemIndName = null;
                        }
 
+                       if ( isset( $elemValue['_subelements'] ) ) {
+                               foreach ( $elemValue['_subelements'] as $subElemId ) {
+                                       if ( isset( $elemValue[$subElemId] ) && !is_array( $elemValue[$subElemId] ) ) {
+                                               $elemValue[$subElemId] = array( '*' => $elemValue[$subElemId] );
+                                       }
+                               }
+                               unset( $elemValue['_subelements'] );
+                       }
+
                        $indElements = array();
                        $subElements = array();
                        foreach ( $elemValue as $subElemId => & $subElemValue ) {
@@ -228,20 +237,13 @@ class ApiFormatXml extends ApiFormatBase {
 
        public function getAllowedParams() {
                return array(
-                       'xslt' => null,
-                       'includexmlnamespace' => false,
-               );
-       }
-
-       public function getParamDescription() {
-               return array(
-                       'xslt' => 'If specified, adds <xslt> as stylesheet. This should be a wiki page '
-                               . 'in the MediaWiki namespace whose page name ends with ".xsl"',
-                       'includexmlnamespace' => 'If specified, adds an XML namespace'
+                       'xslt' => array(
+                               ApiBase::PARAM_HELP_MSG => 'apihelp-xml-param-xslt',
+                       ),
+                       'includexmlnamespace' => array(
+                               ApiBase::PARAM_DFLT => false,
+                               ApiBase::PARAM_HELP_MSG => 'apihelp-xml-param-includexmlnamespace',
+                       ),
                );
        }
-
-       public function getDescription() {
-               return 'Output data in XML format' . parent::getDescription();
-       }
 }