function MTimeProtectedFastFileStorage::getContainingDirectoryFullPath

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php \Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage::getContainingDirectoryFullPath()
  2. 10 core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php \Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage::getContainingDirectoryFullPath()
  3. 11.x core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php \Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage::getContainingDirectoryFullPath()

Gets the full path of the file storage directory's parent.

Parameters

string $name: The virtual file name. Can be a relative path.

Return value

string The full path of the containing directory where the file is or should be stored.

4 calls to MTimeProtectedFastFileStorage::getContainingDirectoryFullPath()
MTimeProtectedFastFileStorage::delete in core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
Deletes PHP code from storage.
MTimeProtectedFastFileStorage::garbageCollection in core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
Performs garbage collection on the storage.
MTimeProtectedFastFileStorage::getFullPath in core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
Gets the full path where the file is or should be stored.
MTimeProtectedFastFileStorage::save in core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
Saves PHP code to storage.

File

core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 197

Class

MTimeProtectedFastFileStorage
Stores PHP code in files with securely hashed names.

Namespace

Drupal\Component\PhpStorage

Code

protected function getContainingDirectoryFullPath($name) {
    // Remove the .php file extension from the directory name.
    // Within a single directory, a subdirectory cannot have the same name as a
    // file. Thus, when switching between MTimeProtectedFastFileStorage and
    // FileStorage, the subdirectory or the file cannot be created in case the
    // other file type exists already.
    if (substr($name, -4) === '.php') {
        $name = substr($name, 0, -4);
    }
    return $this->directory . '/' . str_replace('/', '#', $name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.