CRM-18079 fix
authordeb.monish <monish.deb@webaccessglobal.com>
Wed, 24 Feb 2016 11:55:21 +0000 (17:25 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Wed, 24 Feb 2016 11:55:21 +0000 (17:25 +0530)
CRM/Core/Config/Runtime.php
Civi/Core/Container.php

index 28583382d31c3dac118c8764214547b3a7f3eca1..b6e4ee13c6d2ac8bd448c80504dcd3b55b9642d2 100644 (file)
@@ -32,7 +32,7 @@
  * the DSN, CMS type, CMS URL, etc. Generally, runtime properties must be
  * determined externally (before loading CiviCRM).
  */
-class CRM_Core_Config_Runtime {
+class CRM_Core_Config_Runtime extends CRM_Core_Config_MagicMerge {
 
   public $dsn;
 
@@ -135,11 +135,6 @@ class CRM_Core_Config_Runtime {
 
     $this->templateDir = array(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
 
-    // FIXME
-    if (isset($this->customPHPPathDir) && $this->customPHPPathDir) {
-      set_include_path($this->customPHPPathDir . PATH_SEPARATOR . get_include_path());
-    }
-
     $this->initialized = 1;
   }
 
@@ -148,6 +143,20 @@ class CRM_Core_Config_Runtime {
     exit();
   }
 
+  /**
+   * Include custom PHP and template paths
+   */
+  public function includeCustomPath() {
+    $customProprtyName = array('customPHPPathDir', 'customTemplateDir');
+    foreach ($customProprtyName as $property) {
+      $value = $this->getSettings()->get($property);
+      if (!empty($value)) {
+        $customPath = Civi::paths()->getPath($value);
+        set_include_path($customPath . PATH_SEPARATOR . get_include_path());
+      }
+    }
+  }
+
   /**
    * Create a unique identification code for this runtime.
    *
index e8d71486bb1c29f2a38ed206d865d97e2145a420..ce9d9479560bdfe048b8ada3906f5f28fb54e2e5 100644 (file)
@@ -358,6 +358,8 @@ class Container {
       \CRM_Extension_System::singleton(TRUE);
       \CRM_Extension_System::singleton(TRUE)->getClassLoader()->register();
 
+      $runtime->includeCustomPath();
+
       $c = new self();
       $container = $c->loadContainer();
       foreach ($bootServices as $name => $obj) {