session_cache_file.install in Session Cache API 8
Same filename and directory in other branches
File
session_cache_file/session_cache_file.installView source
<?php
/**
* @file
* session_cache_file.install
*/
/**
* Implements hook_uninstall().
*/
function session_cache_file_uninstall() {
require_once 'session_cache_file.module';
$session_cache_root = session_cache_file_directory();
if ($session_cache_root) {
// Delete session cache root and all directories and files below it.
session_cache_file_rrmdir($session_cache_root);
}
}
/**
* Recursively delete a directory and all files in it.
*
* PHP's rmdir() only deletes if the directory is empty so we empty directories
* recursively before calling rmdir().
*
* @param string $dir
*/
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;
}
Functions
Name | Description |
---|---|
session_cache_file_rrmdir | Recursively delete a directory and all files in it. |
session_cache_file_uninstall | Implements hook_uninstall(). |