Merge pull request #18930 from MegaphoneJon/financial-156
[civicrm-core.git] / CRM / Utils / System / Backdrop.php
index 83b66078cd1c013fc4f5c14e40b2b0cbde544a56..9e7f5640132f5ed86fa8e93ab0350968d2665440 100644 (file)
@@ -524,7 +524,9 @@ AND    u.status = 1
     }
     // load Backdrop bootstrap
     chdir($cmsPath);
-    define('BACKDROP_ROOT', $cmsPath);
+    if (!defined('BACKDROP_ROOT')) {
+      define('BACKDROP_ROOT', $cmsPath);
+    }
 
     // For Backdrop multi-site CRM-11313
     if ($realPath && strpos($realPath, 'sites/all/modules/') === FALSE) {
@@ -1031,4 +1033,20 @@ AND    u.status = 1
     $e->list[] = 'js/crm.backdrop.js';
   }
 
+  /**
+   * Start a new session.
+   */
+  public function sessionStart() {
+    if (function_exists('backdrop_session_start')) {
+      // https://issues.civicrm.org/jira/browse/CRM-14356
+      if (!(isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
+        backdrop_session_start();
+      }
+      $_SESSION = [];
+    }
+    else {
+      session_start();
+    }
+  }
+
 }