Make SqlBagOStuff respect WRITE_SYNC flag
[lhc/web/wiklou.git] / includes / SiteConfiguration.php
index b99840f..c3b1a6a 100644 (file)
@@ -133,6 +133,8 @@ class SiteConfiguration {
 
        /**
         * Array of domains that are local and can be handled by the same server
+        *
+        * @deprecated since 1.25; use $wgLocalVirtualHosts instead.
         */
        public $localVHosts = array();
 
@@ -191,7 +193,7 @@ class SiteConfiguration {
         * @param array $params Array of parameters.
         * @return mixed The value of the setting requested.
         */
-       protected function getSetting( $settingName, $wiki, /*array*/ $params ) {
+       protected function getSetting( $settingName, $wiki, array $params ) {
                $retval = null;
                if ( array_key_exists( $settingName, $this->settings ) ) {
                        $thisSetting =& $this->settings[$settingName];
@@ -207,14 +209,14 @@ class SiteConfiguration {
                                // Do tag settings
                                foreach ( $params['tags'] as $tag ) {
                                        if ( array_key_exists( $tag, $thisSetting ) ) {
-                                               if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$tag] ) ) {
+                                               if ( is_array( $retval ) && is_array( $thisSetting[$tag] ) ) {
                                                        $retval = self::arrayMerge( $retval, $thisSetting[$tag] );
                                                } else {
                                                        $retval = $thisSetting[$tag];
                                                }
                                                break 2;
                                        } elseif ( array_key_exists( "+$tag", $thisSetting ) && is_array( $thisSetting["+$tag"] ) ) {
-                                               if ( !isset( $retval ) ) {
+                                               if ( $retval === null ) {
                                                        $retval = array();
                                                }
                                                $retval = self::arrayMerge( $retval, $thisSetting["+$tag"] );
@@ -224,7 +226,7 @@ class SiteConfiguration {
                                $suffix = $params['suffix'];
                                if ( !is_null( $suffix ) ) {
                                        if ( array_key_exists( $suffix, $thisSetting ) ) {
-                                               if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) {
+                                               if ( is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) {
                                                        $retval = self::arrayMerge( $retval, $thisSetting[$suffix] );
                                                } else {
                                                        $retval = $thisSetting[$suffix];
@@ -233,7 +235,7 @@ class SiteConfiguration {
                                        } elseif ( array_key_exists( "+$suffix", $thisSetting )
                                                && is_array( $thisSetting["+$suffix"] )
                                        ) {
-                                               if ( !isset( $retval ) ) {
+                                               if ( $retval === null ) {
                                                        $retval = array();
                                                }
                                                $retval = self::arrayMerge( $retval, $thisSetting["+$suffix"] );
@@ -450,7 +452,7 @@ class SiteConfiguration {
         * @param array $wikiTags The tags assigned to the wiki.
         * @return array
         */
-       protected function mergeParams( $wiki, $suffix, /*array*/ $params, /*array*/ $wikiTags ) {
+       protected function mergeParams( $wiki, $suffix, array $params, array $wikiTags ) {
                $ret = $this->getWikiParams( $wiki );
 
                if ( is_null( $ret['suffix'] ) ) {
@@ -532,7 +534,7 @@ class SiteConfiguration {
                        if ( isset( $this->cfgCache[$wiki] ) ) {
                                $res = array_intersect_key( $this->cfgCache[$wiki], array_flip( $settings ) );
                                if ( count( $res ) == count( $settings ) ) {
-                                       return $res; // cache hit
+                                       return $multi ? $res : current( $res ); // cache hit
                                }
                        } elseif ( !in_array( $wiki, $this->wikis ) ) {
                                throw new MWException( "No such wiki '$wiki'." );
@@ -565,6 +567,8 @@ class SiteConfiguration {
 
        /**
         * Returns true if the given vhost is handled locally.
+        *
+        * @deprecated since 1.25; check if the host is in $wgLocalVirtualHosts instead.
         * @param string $vhost
         * @return bool
         */