clean all temporary files after 15min

This commit is contained in:
Roland Gruber 2013-01-28 21:14:26 +00:00
parent 3e4d0276c4
commit e4855fe538
1 changed files with 4 additions and 4 deletions

View File

@ -157,15 +157,15 @@ class Ldap{
// change random number
mt_srand($this->rand + (microtime() * 1000000));
$this->rand = mt_rand();
// delete PDF files and images which are older than 10 min
// delete PDF files and images which are older than 15 min
$tmpDir = dirname(__FILE__) . '/../tmp/';
$time = time();
$dir = @opendir($tmpDir);
$file = @readdir($dir);
while ($file) {
if ((substr($file, -4) == '.pdf') || (substr($file, -4) == '.jpg') || (substr($file, -4) == '.zip')) {
$path = $tmpDir . $file;
if ($time - filemtime($path) > 600) {
if (($file != '.') && ($file != '..') && ($file != '.htaccess') && !is_dir($path)) {
if ($time - filemtime($path) > 900) {
@unlink($path);
}
}