Merge "Propagate the favicon information to getInfo() for local repos"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 29 Jan 2014 00:19:27 +0000 (00:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 Jan 2014 00:19:27 +0000 (00:19 +0000)
includes/filerepo/FileRepo.php
includes/filerepo/ForeignDBRepo.php
includes/filerepo/LocalRepo.php

index 81529e7..ca8c219 100644 (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] ) ) {
@@ -1853,7 +1856,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 ) ) {
index 92f017f..6e9e6ad 100644 (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();
+       }
 }
index 99c0e09..bcccb71 100644 (file)
@@ -494,4 +494,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 ),
+               ) );
+       }
 }