From 8d47b4f373fd4a3260ca86e18b8a9629017ca42f Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 30 Jan 2015 20:12:33 +0100 Subject: [PATCH] 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 --- includes/api/ApiQuerySiteinfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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']; } -- 2.20.1