From 86a36a73d9ea65926e87262b17e2abfa3dbf532b Mon Sep 17 00:00:00 2001 From: Herb vd Dool Date: Wed, 19 Sep 2018 21:17:28 -0400 Subject: [PATCH] Lookup path-variable for the private filepath --- CRM/Core/Config/Runtime.php | 10 +++++++--- Civi/Core/Container.php | 4 ++-- Civi/Core/Paths.php | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CRM/Core/Config/Runtime.php b/CRM/Core/Config/Runtime.php index d1aef183d9..3b979627f9 100644 --- a/CRM/Core/Config/Runtime.php +++ b/CRM/Core/Config/Runtime.php @@ -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'); } diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 55c2b92e2b..689c3baf19 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -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(); diff --git a/Civi/Core/Paths.php b/Civi/Core/Paths.php index 31c9266013..8271f7ba4c 100644 --- a/Civi/Core/Paths.php +++ b/Civi/Core/Paths.php @@ -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, '/') . '/']; }) -- 2.25.1