This is useful when you are config and testing the chat.
Enjoy it.
[]'s,
Rafael.
- Code: Select all
<?
// REMOVE ALL CACHE, LOGS AND CHAT HISTORY FILES STORAGE IN /PHPFREECHAT/DATA/PRIVATE
// Based in script posted by <torch at torchsdomain dot com> on PHP site.
$pathToChatBase = "/home/rafael/public_html/phpfreechat";
function rfr($path,$match){
echo "<BR>CURRENT DIR: ".$path."<BR>";
static $deld = 0, $dsize = 0;
$dirs = glob($path."*");
$files = glob($path.$match);
foreach($files as $file){
if(is_file($file)){
$dsize += filesize($file);
if (unlink($file)){
echo "<BR>Removed file: $file";
}else{
echo "<BR>NOT removed file: $file";
}
$deld++;
}
}
foreach($dirs as $dir){
if(is_dir($dir)){
$dir = basename($dir) . "/";
rfr($path.$dir,$match);
}
}
foreach($dirs as $dir){
if(is_dir($dir)){
if (rmdir($dir)){
echo "<BR>Removed dir: $dir";
}else{
echo "<BR>NOT removed dir: $dir";
}
}
}
echo "<BR><BR>$deld files deleted with a total size of $dsize bytes<BR><BR>";
}
rfr($pathToChatBase.'/data/private/chat/','*');
rfr($pathToChatBase.'/data/private/cache/','*');
rfr($pathToChatBase.'/data/private/logs/','*');
rfr($pathToChatBase.'/data/private/','debugchat*');
?>