com web/php: Do not overwrite $MYSITE unless the new version actually exists: include/site.inc

From: Date: Tue, 28 Dec 2010 11:42:50 +0000
Subject: com web/php: Do not overwrite $MYSITE unless the new version actually exists: include/site.inc
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-23728@lists.php.net to get a copy of this message
Commit: 191ca694f73ef81b6b9a8365d06031320b04e555 Author: Hannes Magnusson <bjori@php.net> Tue, 28 Dec 2010 11:42:50 +0000 Parents: b310ac928eb45a0a5efea1ed78e6d618664f889c Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=191ca694f73ef81b6b9a8365d06031320b04e555 Log: Do not overwrite $MYSITE unless the new version actually exists Changed paths: M include/site.inc Diff: diff --git a/include/site.inc b/include/site.inc index d465730...6cc0911 100644 --- a/include/site.inc +++ b/include/site.inc @@ -375,10 +375,16 @@ if (!isset($MIRRORS[$MYSITE])) { // the browser (in the Host HTTP header). if($_SERVER["SERVER_PORT"] != '80') { - $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; + $tmp = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . ':' . (int)$_SERVER["SERVER_PORT"] . '/'; } else { - $MYSITE = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; + $tmp = 'http://' . preg_replace("!^www\\.!", "", $_SERVER["SERVER_NAME"]) . '/'; } + + // If the name without www. exists, use it + if (isset($MIRRORS[$tmp])) { + $MYSITE = $tmp; + } + // If the mirror is not registered with this name, provide defaults // (no country code, no search, no stats, English default language ...) if (!isset($MIRRORS[$MYSITE])) {

« previous php.webmaster (#23728) next »