Propagate the favicon information to getInfo()
authorgilles <gdubuc@wikimedia.org>
Wed, 15 Jan 2014 16:08:19 +0000 (17:08 +0100)
committergilles <gdubuc@wikimedia.org>
Fri, 17 Jan 2014 16:06:44 +0000 (17:06 +0100)
This is needed by MultimediaViewer to show a relevant icon next to the foreign repo link to the description page

Change-Id: Id02743b036a2b88677d76613a73787874f5e448b
Mingle: Multimedia card #107

includes/api/ApiQuerySiteinfo.php
includes/filerepo/ForeignAPIRepo.php

index dc76a2d..2e0bbfd 100644 (file)
@@ -124,7 +124,11 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['mainpage'] = $mainPage->getPrefixedText();
                $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT );
                $data['sitename'] = $GLOBALS['wgSitename'];
-               $data['logo'] = $GLOBALS['wgLogo'];
+
+               // wgLogo can either be a relative or an absolute path
+               // make sure we always return an absolute path
+               $data['logo'] = wfExpandUrl( $GLOBALS['wgLogo'], PROTO_RELATIVE );
+
                $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
                $data['phpversion'] = phpversion();
                $data['phpsapi'] = PHP_SAPI;
@@ -254,7 +258,9 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                }
 
                if ( !empty( $GLOBALS['wgFavicon'] ) ) {
-                       $data['favicon'] = $GLOBALS['wgFavicon'];
+                       // wgFavicon can either be a relative or an absolute path
+                       // make sure we always return an absolute path
+                       $data['favicon'] = wfExpandUrl( $GLOBALS['wgFavicon'], PROTO_RELATIVE );
                }
 
                wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
index 8906834..8ae53de 100644 (file)
@@ -485,6 +485,10 @@ class ForeignAPIRepo extends FileRepo {
 
                        $info['articlepath'] = $general['articlepath'];
                        $info['server'] = $general['server'];
+
+                       if ( isset( $general['favicon'] ) ) {
+                               $info['favicon'] = $general['favicon'];
+                       }
                }
 
                return $info;