protected function FileStorage::unlink in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Component/PhpStorage/FileStorage.php \Drupal\Component\PhpStorage\FileStorage::unlink()
Deletes files and/or directories in the specified path.
If the specified path is a directory the method will call itself recursively to process the contents. Once the contents have been removed the directory will also be removed.
Parameters
string $path: A string containing either a file or directory path.
Return value
bool TRUE for success or if path does not exist, FALSE in the event of an error.
4 calls to FileStorage::unlink()
- FileStorage::delete in core/
lib/ Drupal/ Component/ PhpStorage/ FileStorage.php - Deletes PHP code from storage.
- FileStorage::deleteAll in core/
lib/ Drupal/ Component/ PhpStorage/ FileStorage.php - Removes all files in this bin.
- 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.
File
- core/
lib/ Drupal/ Component/ PhpStorage/ FileStorage.php, line 230 - Contains \Drupal\Component\PhpStorage\FileStorage.
Class
- FileStorage
- Stores the code as regular PHP files.
Namespace
Drupal\Component\PhpStorageCode
protected function unlink($path) {
if (file_exists($path)) {
if (is_dir($path)) {
// Ensure the folder is writable.
@chmod($path, 0777);
foreach (new \DirectoryIterator($path) as $fileinfo) {
if (!$fileinfo
->isDot()) {
$this
->unlink($fileinfo
->getPathName());
}
}
return @rmdir($path);
}
// Windows needs the file to be writable.
@chmod($path, 0700);
return @unlink($path);
}
// If there's nothing to delete return TRUE anyway.
return TRUE;
}