Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#4988 Standalone - use regular php session during install #29352

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CRM/Utils/System/Standalone.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,26 @@ public function permissionDenied() {
* Start a new session.
*/
public function sessionStart() {
$session_handler = new SessionHandler();
session_set_save_handler($session_handler);
if (defined('CIVI_SETUP')) {
// during installation we can't use the session
// handler from the extension yet so we just
// use a default php session
// use a different cookie name to avoid any nasty clash
$session_cookie_name = 'SESSCIVISOINSTALL';
}
else {
$session_handler = new SessionHandler();
session_set_save_handler($session_handler);
$session_cookie_name = 'SESSCIVISO';
}

$session_max_lifetime = Civi::settings()->get('standaloneusers_session_max_lifetime') ?? 1440;

session_start([
'cookie_httponly' => 1,
'cookie_secure' => !empty($_SERVER['HTTPS']),
'gc_maxlifetime' => $session_max_lifetime,
'name' => 'SESSCIVISO',
'name' => $session_cookie_name,
'use_cookies' => 1,
'use_only_cookies' => 1,
'use_strict_mode' => 1,
Expand Down