Partially revert some of the changes to Config.php just made, a=chris

Chris Pollett [2019-07-10 21:Jul:th]
Partially revert some of the changes to Config.php just made, a=chris
Filename
src/configs/Config.php
diff --git a/src/configs/Config.php b/src/configs/Config.php
index 4fe1275b3..2f3e416a8 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -172,7 +172,7 @@ nsdefine('MIN_AD_VERSION', 36);
 nsdefine('RESOURCES_WIKI_VERSION', 5);
 /**
  * nsdefine's the BASE_URL constant for this script
- * if run from the command line as part of index.php HTTP server script
+ * if run from the command line as part of index.php HTTP server scrip
  * set the current working directory as well
  */
 function initializeBaseUrlAndCurrentWorkingDirectory()
@@ -232,9 +232,6 @@ function initializeBaseUrlAndCurrentWorkingDirectory()
     }
     $server_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] :
         "localhost";
-    if (nsdefined('NAME_SERVER') && NAME_SERVER == "www." . $server_name) {
-        $server_name = NAME_SERVER;
-    }
     if (strpos($server_name, ":") !== false && $server_name[0] != '[') {
         $server_name = "[$server_name]"; //guessing ipv6 address
     }
@@ -269,6 +266,7 @@ if (file_exists(BASE_DIR . "/configs/LocalConfig.php")) {
         way to set work directory) */
     require_once(BASE_DIR . "/configs/LocalConfig.php");
 }
+initializeBaseUrlAndCurrentWorkingDirectory();
 /** Yioop Namespace*/
 nsdefine('NS', "seekquarry\\yioop\\");
 /** controllers sub-namespace */
@@ -412,7 +410,6 @@ if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
         file_put_contents(WORK_DIRECTORY . PROFILE_FILE_NAME, $new_profile);
     }
     require_once WORK_DIRECTORY . PROFILE_FILE_NAME;
-    initializeBaseUrlAndCurrentWorkingDirectory();
     nsdefine('PROFILE', true);
     nsdefine('CRAWL_DIR', WORK_DIRECTORY);
     if (is_dir(APP_DIR."/locale")) {
@@ -435,7 +432,6 @@ if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
         nsdefine("FIX_NAME_SERVER", true);
     }
 } else {
-    initializeBaseUrlAndCurrentWorkingDirectory();
     if ((!isset( $_SERVER['SERVER_NAME']) ||
         $_SERVER['SERVER_NAME']!=='localhost')
         && !nsdefined("NO_LOCAL_CHECK") && !nsdefined("WORK_DIRECTORY")
ViewGit