Add some siteinfo to the repo info array
authorMark Holmquist <mtraceur@member.fsf.org>
Tue, 8 Oct 2013 07:01:54 +0000 (00:01 -0700)
committerMark Holmquist <mtraceur@member.fsf.org>
Tue, 8 Oct 2013 21:23:26 +0000 (14:23 -0700)
Used for linking to user pages on remote repos in the
MultimediaViewer extension.

Change-Id: Ia703d63e8e02b1e8fbc90b7d7f90a748d9e177ec

includes/filerepo/ForeignAPIRepo.php

index eb16093..b1a3962 100644 (file)
@@ -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;
        }