Commit a82510ad authored by Richard Mansfield's avatar Richard Mansfield

Increase thumbnail cache time & remove messages from cron log

See bug #547803.

Removes debug messages which generate thousands of additional lines in
the cron log.

Also increases the length of time that resized images are cached.  We
don't need to regenerate all the thumbnails every week, because we're
always checking that the original still exists before serving the
thumbnail.

Change-Id: If824d5695a110452855c0313af9d6c9f4b3480c6
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent e90ff142
......@@ -827,7 +827,7 @@ function file_cleanup_old_cached_files() {
continue;
}
$mintime = time() - (7 * 24 * 60 * 60); // delete caches older than 1 week
$mintime = time() - (12 * 7 * 24 * 60 * 60); // delete caches older than 12 weeks
// Cached files are stored in a three tier md5sum layout
// The actual files are stored in the third directory
......@@ -849,22 +849,18 @@ function file_cleanup_old_cached_files() {
$fileiter = new DirectoryIterator($dir3path);
foreach ($fileiter as $file) {
if ($file->isFile() && $file->getCTime() < $mintime) {
log_debug('Deleting stale cache file ' . $file->getPath() . '/' . $file->getFilename());
unlink($file->getPath() . '/' . $file->getFilename());
}
}
if (sizeof(scandir($dir3path)) <= 2) { // first 2 entries are . and ..
log_debug('Deleting empty folder ' . $dir3path);
rmdir($dir3path);
}
}
if (sizeof(scandir($dir2path)) <= 2) { // first 2 entries are . and ..
log_debug('Deleting empty folder ' . $dir2path);
rmdir($dir2path);
}
}
if (sizeof(scandir($dir1path)) <= 2) { // first 2 entries are . and ..
log_debug('Deleting empty folder ' . $dir1path);
rmdir($dir1path);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment