Replace $wgConf->localVHosts by $wgLocalVirtualHosts
authorAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Mon, 1 Sep 2014 20:26:36 +0000 (22:26 +0200)
committerKunal Mehta <legoktm@gmail.com>
Fri, 3 Oct 2014 10:54:44 +0000 (03:54 -0700)
The former is independent of the remaining of the SiteConfiguration
class, and as thus makes more sense to be defined as an explicit
configuration setting rather that being hidden in $wgConf.

Change-Id: I25204d37c5cfffb6953fe53e14316dc3df5b5b10

RELEASE-NOTES-1.25
includes/DefaultSettings.php
includes/HttpFunctions.php
includes/SiteConfiguration.php

index a21b684..db4c124 100644 (file)
@@ -10,6 +10,7 @@ production.
 
 === Configuration changes in 1.25 ===
 * $wgPageShowWatchingUsers was removed.
+* $wgLocalVirtualHosts has been added to replace $wgConf->localVHosts.
 
 === New features in 1.25 ===
 * (bug 58139) ResourceLoaderFileModule now supports language fallback
index 510c1dd..c6e91cf 100644 (file)
@@ -7083,6 +7083,18 @@ $wgAsyncHTTPTimeout = 25;
  */
 $wgHTTPProxy = false;
 
+/**
+ * Local virtual hosts.
+ *
+ * This lists domains that are configured as virtual hosts on the same machine.
+ * If a request is to be made to a domain listed here, or any subdomain thereof,
+ * then no proxy will be used.
+ * Command-line scripts are not affected by this setting and will always use
+ * proxy if it is configured.
+ * @since 1.25
+ */
+$wgLocalVirtualHosts = array();
+
 /**
  * Timeout for connections done internally (in seconds)
  * Only works for curl
index 8302124..f9ee14b 100644 (file)
@@ -114,7 +114,7 @@ class Http {
         * @return bool
         */
        public static function isLocalURL( $url ) {
-               global $wgCommandLineMode, $wgConf;
+               global $wgCommandLineMode, $wgLocalVirtualHosts, $wgConf;
 
                if ( $wgCommandLineMode ) {
                        return false;
@@ -126,7 +126,7 @@ class Http {
                        $host = $matches[1];
                        // Split up dotwise
                        $domainParts = explode( '.', $host );
-                       // Check if this domain or any superdomain is listed in $wgConf as a local virtual host
+                       // Check if this domain or any superdomain is listed as a local virtual host
                        $domainParts = array_reverse( $domainParts );
 
                        $domain = '';
@@ -139,7 +139,9 @@ class Http {
                                        $domain = $domainPart . '.' . $domain;
                                }
 
-                               if ( $wgConf->isLocalVHost( $domain ) ) {
+                               if ( in_array( $domain, $wgLocalVirtualHosts )
+                                       || $wgConf->isLocalVHost( $domain )
+                               ) {
                                        return true;
                                }
                        }
index 8c1f26b..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();
 
@@ -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
         */