MTimeProtectedFileStorage::exists

public MTimeProtectedFileStorage::exists($name) Checks whether the PHP code exists in storage. Parameters string $name: The virtual file name. Can be a relative path. Return value bool TRUE if the virtual file exists, FALSE otherwise. Overrides FileStorage::exists File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php, line 48 Class MTimeProtectedFileStorage Stores PHP code in files with securely hashed names. Namespace Drupal\Component\PhpStorage Code public functio

MTimeProtectedFileStorage::checkFile

protected MTimeProtectedFileStorage::checkFile($name) Determines whether a protected file exists and sets the filename too. Parameters string $name: The virtual file name. Can be a relative path. Return value string|false The full path where the file is if it is valid, FALSE otherwise. File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php, line 61 Class MTimeProtectedFileStorage Stores PHP code in files with securely hashed names. Namespace Drupal\Component\PhpStorag

MTimeProtectedFileStorage

Stores PHP code in files with securely hashed names. The goal of this class is to ensure that if a PHP file is replaced with an untrusted one, it does not get loaded. Since mtime granularity is 1 second, we cannot prevent an attack that happens within one second of the initial save(). However, it is very unlikely for an attacker exploiting an upload or file write vulnerability to also know when a legitimate file is being saved, discover its hash, undo its file permissions, and override the file

MTimeProtectedFastFileStorage::__construct

public MTimeProtectedFastFileStorage::__construct(array $configuration) Constructs this MTimeProtectedFastFileStorage object. Parameters array $configuration: An associated array, containing at least these keys (the rest are ignored): directory: The directory where the files should be stored. secret: A cryptographically hard to guess secret string. -bin. The storage bin. Multiple storage objects can be instantiated with the same configuration, but for different bins. Overrides FileStorage:

MTimeProtectedFastFileStorage::tempnam

protected MTimeProtectedFastFileStorage::tempnam($directory, $prefix) A brute force tempnam implementation supporting streams. Parameters $directory: The directory where the temporary filename will be created. $prefix: The prefix of the generated temporary filename. Return value string Returns the new temporary filename (with path), or FALSE on failure. File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 226 Class MTimeProtectedFastFileStorage Stores PHP cod

MTimeProtectedFastFileStorage::save

public MTimeProtectedFastFileStorage::save($name, $data) Saves PHP code to storage. Parameters string $name: The virtual file name. Can be a relative path. string $code: The PHP code to be saved. Return value bool TRUE if the save succeeded, FALSE if it failed. Overrides FileStorage::save File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 63 Class MTimeProtectedFastFileStorage Stores PHP code in files with securely hashed names. Namespace Drupal\Componen

MTimeProtectedFastFileStorage::getUncachedMTime

protected MTimeProtectedFastFileStorage::getUncachedMTime($directory) Clears PHP's stat cache and returns the directory's mtime. File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 211 Class MTimeProtectedFastFileStorage Stores PHP code in files with securely hashed names. Namespace Drupal\Component\PhpStorage Code protected function getUncachedMTime($directory) { clearstatcache(TRUE, $directory); return filemtime($directory); }

MTimeProtectedFastFileStorage::getFullPath

public MTimeProtectedFastFileStorage::getFullPath($name, &$directory = NULL, &$directory_mtime = NULL) Gets the full path where the file is or should be stored. This function creates a file path that includes a unique containing directory for the file and a file name that is a hash of the virtual file name, a cryptographic secret, and the containing directory mtime. If the file is overridden by an insecure upload script, the directory mtime gets modified, invalidating the file, thus pro

MTimeProtectedFastFileStorage::getContainingDirectoryFullPath

protected MTimeProtectedFastFileStorage::getContainingDirectoryFullPath($name) Gets the full path of the containing directory where the file is or should be stored. 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. File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 196 Class MTimeProtectedFastFileStorage Stores PHP code in files with se

MTimeProtectedFastFileStorage::garbageCollection

public MTimeProtectedFastFileStorage::garbageCollection() Performs garbage collection on the storage. The storage may choose to delete expired or invalidated items. Overrides FileStorage::garbageCollection File core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php, line 150 Class MTimeProtectedFastFileStorage Stores PHP code in files with securely hashed names. Namespace Drupal\Component\PhpStorage Code public function garbageCollection() { $flags = \FilesystemIterat