12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
- class NativeFileSessionHandler extends NativeSessionHandler
- {
-
- public function __construct($savePath = null)
- {
- if (null === $savePath) {
- $savePath = ini_get('session.save_path');
- }
- $baseDir = $savePath;
- if ($count = substr_count($savePath, ';')) {
- if ($count > 2) {
- throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
- }
-
- $baseDir = ltrim(strrchr($savePath, ';'), ';');
- }
- if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
- throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
- }
- ini_set('session.save_path', $savePath);
- ini_set('session.save_handler', 'files');
- }
- }
|