From e4855fe538bc506fd04f050c2d7857cca9df6949 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 28 Jan 2013 21:14:26 +0000 Subject: [PATCH] clean all temporary files after 15min --- lam/lib/ldap.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lam/lib/ldap.inc b/lam/lib/ldap.inc index d956f3b3..db38c35f 100644 --- a/lam/lib/ldap.inc +++ b/lam/lib/ldap.inc @@ -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) { + $path = $tmpDir . $file; + if (($file != '.') && ($file != '..') && ($file != '.htaccess') && !is_dir($path)) { + if ($time - filemtime($path) > 900) { @unlink($path); } }