From: Alex Monk Date: Mon, 6 Apr 2015 17:24:15 +0000 (+0100) Subject: Fix ApiQuerySiteInfo with siprop=rightsinfo to not die if your wgRightsPage is null X-Git-Tag: 1.31.0-rc.0~11829^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=89f2f724705cf8030fdc486fc6753a049ffa76df;p=lhc%2Fweb%2Fwiklou.git Fix ApiQuerySiteInfo with siprop=rightsinfo to not die if your wgRightsPage is null Follows-up I2b36b7a3 Change-Id: I7d76cd48021a0097ce5e11f4ad4100cb85ee5ad0 --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 5ac10366e5..d4f7e6abc1 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -674,8 +674,14 @@ class ApiQuerySiteinfo extends ApiQueryBase { protected function appendRightsInfo( $property ) { $config = $this->getConfig(); - $title = Title::newFromText( $config->get( 'RightsPage' ) ); - $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $config->get( 'RightsUrl' ); + $rightsPage = $config->get( 'RightsPage' ); + if ( is_string( $rightsPage ) ) { + $title = Title::newFromText( $rightsPage ); + $url = wfExpandUrl( $title, PROTO_CURRENT ); + } else { + $title = false; + $url = $config->get( 'RightsUrl' ); + } $text = $config->get( 'RightsText' ); if ( !$text && $title ) { $text = $title->getPrefixedText();