function brilliant_gallery_cleantmpdir in Brilliant Gallery 7
Same name and namespace in other branches
- 6.4 cron.inc \brilliant_gallery_cleantmpdir()
- 6.3 brilliant_gallery.module \brilliant_gallery_cleantmpdir()
@todo Please document this function.
See also
1 call to brilliant_gallery_cleantmpdir()
- brilliant_gallery_cron in ./
brilliant_gallery_cron.inc - Delete all expired images from the file cache folder brilliant_gallery_pcache.
File
- ./
brilliant_gallery_cron.inc, line 33
Code
function brilliant_gallery_cleantmpdir() {
// Delete files and directories from the file cache directory if their time is up!
$timenow = REQUEST_TIME;
$bgcachexpire = brilliant_gallery_get_days_in_seconds(variable_get('brilliant_gallery_cache_duration', 90));
$timestampexpired = REQUEST_TIME - $bgcachexpire;
$cachetempdirectory = variable_get('brilliant_gallery_pcache', BRILLIANT_GALLERY_DEFAULT_CACHE_DIR);
//brilliant_gallery_check_or_create_dir($cachetempdirectory);
$cachetempdirectory = realpath(FILE_DIRECTORY_PATH) . '/' . $cachetempdirectory;
$GLOBALS['bg_removedcnt'] = 0;
brilliant_gallery_rmdir_recursive($cachetempdirectory, $timestampexpired);
// Also clear the Drupal cache - otherwise there might be some cached HTML pointing to files that are no longer in the file cache.
cache_clear_all();
watchdog('Brilliant Gal', 'Cleared ' . $GLOBALS['bg_removedcnt'] . ' files from the temp directory ' . $cachetempdirectory . ' after ' . variable_get('brilliant_gallery_cache_duration', 90) . ' days. Elapsed time: ' . (REQUEST_TIME - $timenow) . ' seconds.');
}