protected function MTimeProtectedFastFileStorage::ensureDirectory

Ensures the root directory exists and has correct permissions.

1 call to MTimeProtectedFastFileStorage::ensureDirectory()

File

drupal/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 148
Definition of Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage.

Class

MTimeProtectedFastFileStorage
Stores PHP code in files with securely hashed names.

Namespace

Drupal\Component\PhpStorage

Code

protected function ensureDirectory() {
  if (!file_exists($this->directory)) {
    mkdir($this->directory, 0700, TRUE);
  }
  chmod($this->directory, 0700);
  $htaccess_path = $this->directory . '/.htaccess';
  if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, self::HTACCESS)) {
    @chmod($htaccess_path, 0444);
  }
}