From: Gergő Tisza Date: Wed, 15 Jan 2014 20:38:11 +0000 (+0000) Subject: Propagate the favicon information to getInfo() for local repos X-Git-Tag: 1.31.0-rc.0~17107^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=8073d4f2267d99f241d1c35dbb02ddd0bf8d12ed;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index cab5690f9b..12eff0ec4b 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -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 ) ) { diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 92f017f6c6..6e9e6add48 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -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(); + } } diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index c5346aa1c4..5a99fd3174 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -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 ), + ) ); + } }