From 9a13b5fda600936bad646d7c145ef6e6e679c3b5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 9 Jul 2019 21:53:04 -0700 Subject: [PATCH] (dev/cloud-native#3) CRM_Core_IDS - Change CIVICRM_TEMPLATE_COMPILEDIR to 'civicrm.compile' The broader PR seeks to make path computation more intuitive, which requires computing the path to `templates_c` using a function. This PR replaces the reference to `CIVICRM_TEMPLATE_COMPILEDIR` with a function-call to `Civi::paths()->getVariable()`. Is it safe change to make this change in `CRM_Core_IDS`? Will the `Civi::paths()` be callable? Yes, here's why I believe so: * (Big picture) Civi completes the bootstrap process (`CRM_Core_Config::singleton()`) and brings critical services online *before* the invoker does any routing or page-processing. The invoker (`CRM_Core_Invoke::runItem()`) is the only thing which uses `CRM_Core_IDS`. * (Little picture) In the changed function `CRM_Core_IDS::createBaseConfig()`, observe that it calls `CRM_Core_Config::singleton()` before running this modified code. That's a tell-tale sign of code that already relies on having a booted system. --- CRM/Core/IDS.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Core/IDS.php b/CRM/Core/IDS.php index 4d0d513e2c..3af51e5833 100644 --- a/CRM/Core/IDS.php +++ b/CRM/Core/IDS.php @@ -118,7 +118,7 @@ class CRM_Core_IDS { */ public static function createBaseConfig() { $config = \CRM_Core_Config::singleton(); - $tmpDir = empty($config->uploadDir) ? CIVICRM_TEMPLATE_COMPILEDIR : $config->uploadDir; + $tmpDir = empty($config->uploadDir) ? Civi::paths()->getVariable('civicrm.compile', 'path') : $config->uploadDir; global $civicrm_root; return [ -- 2.25.1