Output wikiid/api in meta=siteinfo only when non-empty
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 30 Jan 2015 19:12:33 +0000 (20:12 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 30 Jan 2015 19:12:33 +0000 (20:12 +0100)
When using interwiki data from the database the value for iw_wikiid and
iw_api maybe empty strings, because the database does not allow NULL
here.
Suppress the output of the attribute in that case, because there are not
useful.
This should not break clients, because using .cdb (like WMF wikis)
already missing these attributes in the result.

Change-Id: I60b97b4b58fdeaf699951544d418e5dc06e3830a

includes/api/ApiQuerySiteinfo.php

index f373021..4e5c42b 100644 (file)
@@ -429,10 +429,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        if ( substr( $row['iw_url'], 0, 2 ) == '//' ) {
                                $val['protorel'] = '';
                        }
-                       if ( isset( $row['iw_wikiid'] ) ) {
+                       if ( isset( $row['iw_wikiid'] ) && $row['iw_wikiid'] !== '' ) {
                                $val['wikiid'] = $row['iw_wikiid'];
                        }
-                       if ( isset( $row['iw_api'] ) ) {
+                       if ( isset( $row['iw_api'] ) && $row['iw_api'] !== '' ) {
                                $val['api'] = $row['iw_api'];
                        }