Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
compositesessionmanager.php
1
<?php
2
3
namespace
Bitrix\Main\Session
;
4
5
use
Bitrix\Main\Event
;
6
7
final
class
CompositeSessionManager
8
{
9
public
const
EVENT_REGENERATE_SESSION_ID
=
'onRegenerateSessionId'
;
10
12
private
$kernelSession;
14
private
$session;
15
21
public
function
__construct
(
SessionInterface
$kernelSession,
SessionInterface
$session)
22
{
23
$this->kernelSession = $kernelSession;
24
$this->session = $session;
25
}
26
27
public
function
start
(): void
28
{
29
if
(!$this->kernelSession->isStarted())
30
{
31
$this->kernelSession->start();
32
}
33
if
(!$this->session->isStarted())
34
{
35
$this->session->start();
36
}
37
}
38
39
public
function
destroy
(): void
40
{
41
$this->
start
();
42
43
if
($this->kernelSession instanceof
KernelSessionProxy
)
44
{
45
$this->kernelSession->destroy();
46
47
return
;
48
}
49
50
$this->kernelSession->destroy();
51
$this->session->destroy();
52
}
53
54
public
function
clear
(): void
55
{
56
$this->
start
();
57
58
if
($this->kernelSession instanceof
KernelSessionProxy
)
59
{
60
$this->kernelSession->clear();
61
62
return
;
63
}
64
65
$this->kernelSession->clear();
66
$this->session->clear();
67
}
68
69
public
function
regenerateId
(): void
70
{
71
$this->
start
();
72
73
$this->kernelSession->regenerateId();
74
if
(!($this->kernelSession instanceof
KernelSessionProxy
))
75
{
76
$this->session->regenerateId();
77
}
78
79
(
new
Event
(
'main'
, self::EVENT_REGENERATE_SESSION_ID, [
80
'newSessionId'
=> $this->kernelSession->getId(),
81
]))->send();
82
}
83
}
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\Session\CompositeSessionManager
Definition
compositesessionmanager.php:8
Bitrix\Main\Session\CompositeSessionManager\regenerateId
regenerateId()
Definition
compositesessionmanager.php:69
Bitrix\Main\Session\CompositeSessionManager\__construct
__construct(SessionInterface $kernelSession, SessionInterface $session)
Definition
compositesessionmanager.php:21
Bitrix\Main\Session\CompositeSessionManager\destroy
destroy()
Definition
compositesessionmanager.php:39
Bitrix\Main\Session\CompositeSessionManager\clear
clear()
Definition
compositesessionmanager.php:54
Bitrix\Main\Session\CompositeSessionManager\EVENT_REGENERATE_SESSION_ID
const EVENT_REGENERATE_SESSION_ID
Definition
compositesessionmanager.php:9
Bitrix\Main\Session\CompositeSessionManager\start
start()
Definition
compositesessionmanager.php:27
Bitrix\Main\Session\KernelSessionProxy
Definition
kernelsessionproxy.php:6
Bitrix\Main\Session\SessionInterface
Definition
sessioninterface.php:6
Bitrix\Main\Session
Definition
arrayaccesswithreferences.php:3
modules
main
lib
session
compositesessionmanager.php
Создано системой
1.10.0