From: Herb vd Dool Date: Thu, 20 Sep 2018 01:17:28 +0000 (-0400) Subject: Lookup path-variable for the private filepath X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=86a36a73d9ea65926e87262b17e2abfa3dbf532b;p=civicrm-core.git Lookup path-variable for the private filepath --- 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, '/') . '/']; })