Skip to content
Snippets Groups Projects
Commit d074981c authored by Robert J. Lang's avatar Robert J. Lang
Browse files

Issue 8: move session start into CMS-specific classes.

parent c709477e
Branches
Tags
No related merge requests found
......@@ -754,18 +754,6 @@ class CRM_Utils_System {
public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$config = CRM_Core_Config::singleton();
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*
* Q: Can we move this to the userSystem class so that it can be tuned
* per-CMS? For example, when dealing with UnitTests UF, does it need to
* do this session write since the original issue was for Drupal.
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
return $config->userSystem->authenticate($name, $password, $loadCMSBootstrap, $realPath);
}
......
......@@ -315,6 +315,14 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase {
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
$config = CRM_Core_Config::singleton();
$ufDSN = CRM_Utils_SQL::autoSwitchDSN($config->userFrameworkDSN);
......
......@@ -316,6 +316,14 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
* @inheritDoc
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
$system = new CRM_Utils_System_Drupal8();
$system->loadBootStrap([], FALSE);
......
......@@ -325,6 +325,14 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
$config = CRM_Core_Config::singleton();
$user = NULL;
......
......@@ -75,6 +75,14 @@ class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
* @inheritDoc
*/
public function authenticate($name, $pass) {
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
if (isset(self::$ufClass)) {
$className = self::$ufClass;
$result =& $className::authenticate($name, $pass);
......
......@@ -542,6 +542,14 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
* @inheritDoc
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
/* Before we do any loading, let's start the session and write to it.
* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
$config = CRM_Core_Config::singleton();
if ($loadCMSBootstrap) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment