public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$config = CRM_Core_Config::singleton();
- $dbBackdrop = DB::connect($config->userFrameworkDSN);
+ $ufDSN = CRM_Utils_SQL::autoSwitchDSN($config->userFrameworkDSN);
+ $dbBackdrop = DB::connect($ufDSN);
if (DB::isError($dbBackdrop)) {
- throw new CRM_Core_Exception("Cannot connect to Backdrop database via $config->userFrameworkDSN, " . $dbBackdrop->getMessage());
+ throw new CRM_Core_Exception("Cannot connect to Backdrop database via $ufDSN, " . $dbBackdrop->getMessage());
}
$account = $userUid = $userMail = NULL;
}
// 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) {
$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();
+ }
+ }
+
}