From: umherirrender Date: Fri, 30 Jan 2015 19:12:33 +0000 (+0100) Subject: Output wikiid/api in meta=siteinfo only when non-empty X-Git-Tag: 1.31.0-rc.0~12530^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=8d47b4f373fd4a3260ca86e18b8a9629017ca42f;p=lhc%2Fweb%2Fwiklou.git Output wikiid/api in meta=siteinfo only when non-empty 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 --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index f373021e0a..4e5c42b68a 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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']; }