Propagate the favicon information to getInfo() for local repos

This is needed by MultimediaViewer to show a relevant icon next
to the local and foreign db repo link in the description area

The setting ends up in configuration for foreign DB, because the
favicon value is stored in the configuration of a wiki, not in its
database.

Change-Id: I3d0599c1afa13e1d8540ff3c8bc34129a55792c5
This commit is contained in:
Gergő Tisza 2014-01-15 20:38:11 +00:00 committed by gilles
parent d3a816e4b2
commit 8073d4f226
3 changed files with 28 additions and 2 deletions

View file

@ -111,6 +111,9 @@ class FileRepo {
*/
protected $abbrvThreshold;
/** @var string The URL of the repo's favicon, if any */
protected $favicon;
/**
* Factory functions for creating new files
* Override these in the base class
@ -147,7 +150,7 @@ class FileRepo {
$optionalSettings = array(
'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
'thumbScriptUrl', 'pathDisclosureProtection', 'descriptionCacheExpiry',
'scriptExtension'
'scriptExtension', 'favicon'
);
foreach ( $optionalSettings as $var ) {
if ( isset( $info[$var] ) ) {
@ -1845,7 +1848,7 @@ class FileRepo {
$optionalSettings = array(
'url', 'thumbUrl', 'initialCapital', 'descBaseUrl', 'scriptDirUrl', 'articleUrl',
'fetchDescription', 'descriptionCacheExpiry', 'scriptExtension'
'fetchDescription', 'descriptionCacheExpiry', 'scriptExtension', 'favicon'
);
foreach ( $optionalSettings as $k ) {
if ( isset( $this->$k ) ) {

View file

@ -126,4 +126,14 @@ class ForeignDBRepo extends LocalRepo {
protected function assertWritableRepo() {
throw new MWException( get_class( $this ) . ': write operations are not supported.' );
}
/**
* Return information about the repository.
*
* @return array
* @since 1.22
*/
function getInfo() {
return FileRepo::getInfo();
}
}

View file

@ -491,4 +491,17 @@ class LocalRepo extends FileRepo {
$wgMemc->set( $memcKey, ' PURGED', 12 );
}
}
/**
* Return information about the repository.
*
* @return array
* @since 1.22
*/
function getInfo() {
global $wgFavicon;
return array_merge( parent::getInfo(), array(
'favicon' => wfExpandUrl( $wgFavicon ),
) );
}
}