standalone: work on cmsBaseUrl
authorRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Fri, 10 Feb 2023 14:08:38 +0000 (14:08 +0000)
committerRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Fri, 23 Jun 2023 10:49:20 +0000 (11:49 +0100)
setup/plugins/init/Standalone.civi-setup.php

index 1273b953b9b11498e03c414cecf8b7ebd301c369..4d5c5ee625e86faa869eba1c60f37449d13940f4 100644 (file)
@@ -54,10 +54,13 @@ if (!defined('CIVI_SETUP')) {
     // ];
 
     // Compute URLs (@todo?)
-    // $model->cmsBaseUrl = $_SERVER['HTTP_ORIGIN'] ?: $_SERVER['HTTP_REFERER'];
-    $model->cmsBaseUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
+    // original: $model->cmsBaseUrl = $_SERVER['HTTP_ORIGIN'] ?: $_SERVER['HTTP_REFERER'];
+    if (empty($model->cmsBaseUrl)) {
+      // A buildkit install (which uses cv core:install) sets this correctly. But a standard composer-then-website type install does not.
+      $model->cmsBaseUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
+    }
 
-    // These mandatorySettings become 'extra settings from installer' and set values in
+    // These mandatorySettings become 'Additional settings from installer' (via 'extraSettings') and set values in
     // $civicrm_setting['domain'][k] = v;
     $model->mandatorySettings['userFrameworkResourceURL'] = $model->cmsBaseUrl . '/assets/civicrm/core';