]> git.wh0rd.org Git - tt-rss.git/commitdiff
expire_cached_files: check for glob() returning false
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 24 Feb 2012 09:43:50 +0000 (13:43 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 24 Feb 2012 09:43:50 +0000 (13:43 +0400)
include/rssfuncs.php

index 838087d9055e46aa8b663d3ff076261dd26fe609..6d3cfc3bf5ff23b3673ca0a680c5d61efbce36e2 100644 (file)
                        if (is_writable($cache_dir)) {
                                $files = glob("$cache_dir/*");
 
-                               foreach ($files as $file) {
-                                       if (time() - filemtime($file) > 86400*7) {
-                                               unlink($file);
+                               if ($files)
+                                       foreach ($files as $file) {
+                                               if (time() - filemtime($file) > 86400*7) {
+                                                       unlink($file);
 
-                                               ++$num_deleted;
+                                                       ++$num_deleted;
+                                               }
                                        }
                                }
-                       }
 
                        if ($debug) _debug("Removed $num_deleted files.");
                }