Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
nativefilesessionhandler.php
1<?php
2
4
7
8class NativeFileSessionHandler extends \SessionHandler //implements \SessionUpdateTimestampHandlerInterface
9{
10 public function __construct(array $options)
11 {
12 $savePath = $options['savePath'] ?? null;
13 if ($savePath === null)
14 {
15 $savePath = ini_get('session.save_path');
16 }
17
18 $baseDir = $savePath;
19 if ($count = substr_count($savePath, ';'))
20 {
21 if ($count > 2)
22 {
23 throw new ArgumentException('Invalid format for savePath', 'savePath');
24 }
25 $baseDir = ltrim(strrchr($savePath, ';'), ';');
26 }
27
28 if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir))
29 {
30// throw new SystemException("Native file session handler was not able to create directory \"{$baseDir}\".");
31 }
32
33 ini_set('session.save_handler', 'files');
34 ini_set('session.save_path', $savePath);
35 }
36}