From: Mark Holmquist Date: Tue, 8 Oct 2013 07:01:54 +0000 (-0700) Subject: Add some siteinfo to the repo info array X-Git-Tag: 1.31.0-rc.0~18565 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=0d0bfbf253056e237aedb456fbf4059fed62d8c3;p=lhc%2Fweb%2Fwiklou.git Add some siteinfo to the repo info array Used for linking to user pages on remote repos in the MultimediaViewer extension. Change-Id: Ia703d63e8e02b1e8fbc90b7d7f90a748d9e177ec --- diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index eb160932de..b1a3962fe2 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -418,6 +418,24 @@ class ForeignAPIRepo extends FileRepo { function getInfo() { $info = parent::getInfo(); $info['apiurl'] = $this->getApiUrl(); + + $query = array( + 'format' => 'json', + 'action' => 'query', + 'meta' => 'siteinfo', + 'siprop' => 'general', + ); + + $data = $this->httpGetCached( 'SiteInfo', $query, 7200 ); + + if ( $data ) { + $siteInfo = FormatJson::decode( $data, true ); + $general = $siteInfo['query']['general']; + + $info['articlepath'] = $general['articlepath']; + $info['server'] = $general['server']; + } + return $info; }