X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=bin%2Fcli.class.php;h=de72c475b41673eb7f3297a250fd035059de530d;hb=a29a45d40bad75f52f1a13ecc63cc16c220171cb;hp=ec420a6c53bd78402f6348d7fa3743b1972097ee;hpb=feb07870854e6e0081670f2fe33faf579b737eba;p=civicrm-core.git diff --git a/bin/cli.class.php b/bin/cli.class.php index ec420a6c53..de72c475b4 100644 --- a/bin/cli.class.php +++ b/bin/cli.class.php @@ -201,10 +201,21 @@ class civicrm_cli { chdir($civicrm_root); require_once ('civicrm.config.php'); // autoload - require_once $civicrm_root . '/CRM/Core/ClassLoader.php'; + if ( !class_exists('CRM_Core_ClassLoader') ) { + require_once $civicrm_root . '/CRM/Core/ClassLoader.php'; + } 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;