Skip to content
Snippets Groups Projects
Commit 9a13b5fd authored by totten's avatar totten
Browse files

(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.
parent 896050a0
No related branches found
No related tags found
No related merge requests found
......@@ -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 [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment