From: Ken West Date: Mon, 18 Nov 2013 04:44:35 +0000 (+1100) Subject: CRM-13695 set $_SERVER[HTTP_HOST] from CIVICRM_UF_BASEURL X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=84f65b2ebd5dcc769a5b4fa952ba6d2bc71cb337;p=civicrm-core.git CRM-13695 set $_SERVER[HTTP_HOST] from CIVICRM_UF_BASEURL ---------------------------------------- * CRM-13695: cli - set $_SERVER['HTTP_HOST'] from CIVICRM_UF_BASEURL http://issues.civicrm.org/jira/browse/CRM-13695 --- diff --git a/bin/cli.class.php b/bin/cli.class.php index ec420a6c53..1e44a962a7 100644 --- a/bin/cli.class.php +++ b/bin/cli.class.php @@ -205,6 +205,15 @@ class civicrm_cli { CRM_Core_ClassLoader::singleton()->register(); $this->_config = CRM_Core_Config::singleton(); + + // HTTP_HOST will be 'localhost' unless overwritten with the -s argument. + // Now we have a Config object, we can set it from the Base URL. + if ($_SERVER['HTTP_HOST'] == 'localhost') { + $_SERVER['HTTP_HOST'] = preg_replace( + '!^https?://([^/]+)/$!i', + '$1', + $this->_config->userFrameworkBaseURL); + } $class = 'CRM_Utils_System_' . $this->_config->userFramework;