From fb8a4fb0d708cb69731b0f89633f750a248832e4 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Thu, 2 Feb 2023 17:11:44 +0000 Subject: [PATCH] standalone: Fix setting cmsBaseUrl and other paths in installer --- setup/plugins/init/Standalone.civi-setup.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/setup/plugins/init/Standalone.civi-setup.php b/setup/plugins/init/Standalone.civi-setup.php index 8b47333fa8..6441d190a9 100644 --- a/setup/plugins/init/Standalone.civi-setup.php +++ b/setup/plugins/init/Standalone.civi-setup.php @@ -44,9 +44,23 @@ if (!defined('CIVI_SETUP')) { ]; // Compute URLs (@todo?) - $model->cmsBaseUrl = $_SERVER['HTTP_ORIGIN'] ?: $_SERVER['HTTP_REFERER']; + // $model->cmsBaseUrl = $_SERVER['HTTP_ORIGIN'] ?: $_SERVER['HTTP_REFERER']; + $model->cmsBaseUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; + + // These mandatorySettings become 'extra settings from installer' and set values in + // $civicrm_setting['domain'][k] = v; $model->mandatorySettings['userFrameworkResourceURL'] = $model->cmsBaseUrl . '/assets/civicrm/core'; + // These paths get set as + // $civicrm_paths[k]['url'|'path'] = v + $model->paths['cms.root'] = [ + 'path' => $model->webroot . DIRECTORY_SEPARATOR . 'web', + ]; + $model->paths['civicrm.files'] = [ + 'path' => rtrim($model->webroot . DIRECTORY_SEPARATOR . 'web') . DIRECTORY_SEPARATOR . 'upload', + 'url' => $model->cmsBaseUrl . '/upload', + ]; + // Compute default locale. $model->lang = $_REQUEST['lang'] ?? 'en_US'; }); -- 2.25.1