[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/http-foundation/Session/Storage/Handler/ -> NativeFileSessionHandler.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   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   * Native session handler using PHP's built in file storage.
  16   *
  17   * @author Drak <drak@zikula.org>
  18   */
  19  class NativeFileSessionHandler extends NativeSessionHandler
  20  {
  21      /**
  22       * @param string $savePath Path of directory to save session files
  23       *                         Default null will leave setting as defined by PHP.
  24       *                         '/path', 'N;/path', or 'N;octal-mode;/path
  25       *
  26       * @see http://php.net/session.configuration.php#ini.session.save-path for further details.
  27       *
  28       * @throws \InvalidArgumentException On invalid $savePath
  29       */
  30      public function __construct($savePath = null)
  31      {
  32          if (null === $savePath) {
  33              $savePath = ini_get('session.save_path');
  34          }
  35  
  36          $baseDir = $savePath;
  37  
  38          if ($count = substr_count($savePath, ';')) {
  39              if ($count > 2) {
  40                  throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
  41              }
  42  
  43              // characters after last ';' are the path
  44              $baseDir = ltrim(strrchr($savePath, ';'), ';');
  45          }
  46  
  47          if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
  48              throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
  49          }
  50  
  51          ini_set('session.save_path', $savePath);
  52          ini_set('session.save_handler', 'files');
  53      }
  54  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1