standalone: Fix setting cmsBaseUrl and other paths in installer
authorRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Thu, 2 Feb 2023 17:11:44 +0000 (17:11 +0000)
committerRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Fri, 23 Jun 2023 10:46:42 +0000 (11:46 +0100)
setup/plugins/init/Standalone.civi-setup.php

index 8b47333fa8b425b96a26d595c28454a88e088244..6441d190a93cbe5cb96f396ec36c53553b35d253 100644 (file)
@@ -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';
   });