function session_cache_file_rrmdir in Session Cache API 7
Same name and namespace in other branches
- 8 session_cache_file/session_cache_file.install \session_cache_file_rrmdir()
Recursively delete a directory and all files in it.
PHP's rmdir() only deletes if the directory is empty.
Parameters
string $dir: The directory to be removed with all its contents.
1 call to session_cache_file_rrmdir()
- session_cache_file_uninstall in session_cache_file/
session_cache_file.install - Implements hook_uninstall().
File
- session_cache_file/
session_cache_file.install, line 49 - session_cache_file.install
Code
function session_cache_file_rrmdir($dir) {
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (is_dir("{$dir}/{$file}")) {
session_cache_file_rrmdir("{$dir}/{$file}");
}
else {
unlink("{$dir}/{$file}");
}
}
}
return rmdir($dir);
}
return FALSE;
}