(dev/cloud-native#3) MagicMerge - Allow pulling properties directly from Civi::paths
authorTim Otten <totten@civicrm.org>
Wed, 3 Jul 2019 01:02:49 +0000 (18:02 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 16 Jul 2019 01:58:12 +0000 (18:58 -0700)
CRM/Core/Config/MagicMerge.php

index 801f803f3b4e8955307298c3307cd030060887f7..2bc5a8f32eb83684d2ec383e5e3b847b60fa8430 100644 (file)
@@ -241,10 +241,14 @@ class CRM_Core_Config_MagicMerge {
       case 'setting':
         return $this->getSettings()->get($name);
 
+      // The interpretation of 'path' and 'setting-path' is similar, except
+      // that the latter originates in a stored setting.
+      case 'path':
       case 'setting-path':
         // Array(0 => $type, 1 => $setting, 2 => $actions).
-        $value = $this->getSettings()->get($name);
-        $value = Civi::paths()->getPath($value);
+        $value = ($type === 'path')
+          ? Civi::paths()->getVariable($name, 'path')
+          : Civi::paths()->getPath($this->getSettings()->get($name));
         if ($value) {
           $value = CRM_Utils_File::addTrailingSlash($value);
           if (isset($this->map[$k][2]) && in_array('mkdir', $this->map[$k][2])) {
@@ -322,6 +326,7 @@ class CRM_Core_Config_MagicMerge {
       case 'setting':
       case 'setting-path':
       case 'setting-url':
+      case 'path':
       case 'user-system':
       case 'runtime':
       case 'callback':