Just curious
$files = glob(cacheme_directory().\"*\");
foreach($files as $file)
{
$filemtime=filemtime ($file);
Be aware that you'll run into problems if you have a very large number of files in the directory.
If you think this is likely to affect you, consider using a lower level approach such as opendir.
Looks correct to me. I'd just suggest you replace 172800
with 2*24*60*60
for clarity.
/* Delete Cache Files Here */
$dir = "cache/"; /** define the directory **/
/*** cycle through all files in the directory ***/
foreach (glob($dir."*") as $file) {
//foreach (glob($dir.'*.*') as $file){
/*** if file is 24 hours (86400 seconds) old then delete it ***/
if (filemtime($file) < time() - 172800) { // 2 days
unlink($file);
}
}
Hope it help you.