Lookup path-variable for the private filepath
authorHerb vd Dool <herb@freeform.ca>
Thu, 20 Sep 2018 01:17:28 +0000 (21:17 -0400)
committerTim Otten <totten@civicrm.org>
Tue, 16 Jul 2019 01:58:12 +0000 (18:58 -0700)
CRM/Core/Config/Runtime.php
Civi/Core/Container.php
Civi/Core/Paths.php

index d1aef183d9b706cb897dd80aaf68a4d3945d085a..3b979627f930b2ef8a082984bcf2420e139c09dd 100644 (file)
@@ -101,14 +101,18 @@ class CRM_Core_Config_Runtime extends CRM_Core_Config_MagicMerge {
 
     if (defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
       $this->configAndLogDir = CRM_Utils_File::baseFilePath() . 'ConfigAndLog' . DIRECTORY_SEPARATOR;
-      CRM_Utils_File::createDir($this->configAndLogDir);
-      CRM_Utils_File::restrictAccess($this->configAndLogDir);
-
       $this->templateCompileDir = defined('CIVICRM_TEMPLATE_COMPILEDIR') ? CRM_Utils_File::addTrailingSlash(CIVICRM_TEMPLATE_COMPILEDIR) : NULL;
       CRM_Utils_File::createDir($this->templateCompileDir);
       CRM_Utils_File::restrictAccess($this->templateCompileDir);
     }
 
+    $civicrm_private = Civi::paths()->getPath('[civicrm.private]');
+    if (!empty($civicrm_private)) {
+      $this->configAndLogDir = rtrim($civicrm_private, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'ConfigAndLog' . DIRECTORY_SEPARATOR;
+    }
+    CRM_Utils_File::createDir($this->configAndLogDir);
+    CRM_Utils_File::restrictAccess($this->configAndLogDir);
+
     if (!defined('CIVICRM_UF')) {
       $this->fatal('You need to define CIVICRM_UF in civicrm.settings.php');
     }
index 55c2b92e2b317c6d9b15be97e09ce776ae08e603..689c3baf19a2865e1351810b7a37dfd1c73fb50f 100644 (file)
@@ -496,11 +496,11 @@ class Container {
     $bootServices = [];
     \Civi::$statics[__CLASS__]['boot'] = &$bootServices;
 
+    $bootServices['paths'] = new \Civi\Core\Paths();
+
     $bootServices['runtime'] = $runtime = new \CRM_Core_Config_Runtime();
     $runtime->initialize($loadFromDB);
 
-    $bootServices['paths'] = new \Civi\Core\Paths();
-
     $class = $runtime->userFrameworkClass;
     $bootServices['userSystem'] = $userSystem = new $class();
     $userSystem->initialize();
index 31c9266013178ea85097d386d5c704367658503d..8271f7ba4c604e72ac8e030eb69e74ef6fc57242 100644 (file)
@@ -56,6 +56,9 @@ class Paths {
       ->register('civicrm.files', function () {
         return \CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage();
       })
+      ->register('civicrm.private', function () {
+        return \CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage();
+      })
       ->register('wp.frontend.base', function () {
         return ['url' => rtrim(CIVICRM_UF_BASEURL, '/') . '/'];
       })