delete internal files after 24h

This commit is contained in:
Roland Gruber 2012-01-26 20:02:38 +00:00
parent 5e9a233a0b
commit 596a1efafa
1 changed files with 15 additions and 0 deletions

View File

@ -167,6 +167,21 @@ class Ldap{
$file = @readdir($dir);
}
@closedir($dir);
// clean internal files that are older than 24 hours
$tmpDir = dirname(__FILE__) . '/../tmp/internal/';
$time = time();
$dir = @opendir($tmpDir);
$file = @readdir($dir);
while ($file) {
if ((substr($file, -4) == '.tmp')) {
$path = $tmpDir . $file;
if ($time - filemtime($path) > (3600 * 24)) {
@unlink($path);
}
}
$file = @readdir($dir);
}
@closedir($dir);
}
/**