Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • MemcachedSessionHandler
  • MemcacheSessionHandler
  • MongoDbSessionHandler
  • NativeFileSessionHandler
  • NativeSessionHandler
  • NullSessionHandler
  • PdoSessionHandler
  • WriteCheckSessionHandler
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <[email protected]>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
13: 
14: /**
15:  * NativeFileSessionHandler.
16:  *
17:  * Native session handler using PHP's built in file storage.
18:  *
19:  * @author Drak <[email protected]>
20:  */
21: class NativeFileSessionHandler extends NativeSessionHandler
22: {
23:     /**
24:      * Constructor.
25:      *
26:      * @param string $savePath Path of directory to save session files
27:      *                         Default null will leave setting as defined by PHP.
28:      *                         '/path', 'N;/path', or 'N;octal-mode;/path
29:      *
30:      * @see http://php.net/session.configuration.php#ini.session.save-path for further details.
31:      *
32:      * @throws \InvalidArgumentException On invalid $savePath
33:      */
34:     public function __construct($savePath = null)
35:     {
36:         if (null === $savePath) {
37:             $savePath = ini_get('session.save_path');
38:         }
39: 
40:         $baseDir = $savePath;
41: 
42:         if ($count = substr_count($savePath, ';')) {
43:             if ($count > 2) {
44:                 throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
45:             }
46: 
47:             // characters after last ';' are the path
48:             $baseDir = ltrim(strrchr($savePath, ';'), ';');
49:         }
50: 
51:         if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
52:             throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
53:         }
54: 
55:         ini_set('session.save_path', $savePath);
56:         ini_set('session.save_handler', 'files');
57:     }
58: }
59: 
Ratchet API documentation generated by ApiGen 2.8.0