Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileProfilerStorage.php

function FileProfilerStorage::__construct

Constructs the file storage using a "dsn-like" path.

Example : "file:/path/to/the/storage/folder"

Throws

\RuntimeException

File

vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php, line 33

Class

FileProfilerStorage
Storage for profiler using files.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

public function __construct(string $dsn) {
    if (!str_starts_with($dsn, 'file:')) {
        throw new \RuntimeException(\sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
    }
    $this->folder = substr($dsn, 5);
    if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) {
        throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $this->folder));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal