MOON
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 PHP/5.4.10
System: Linux vps.presagepowered.net 2.6.18-398.el5 #1 SMP Tue Sep 16 20:51:48 EDT 2014 i686
User: mckernan (512)
PHP: 5.4.10
Disabled: NONE
Upload Files
File: //scripts.20110601.053605.26125/purge_old_config_caches
#!/usr/bin/perl
# cpanel - purge_old_config_caches                 Copyright(c) 2009 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cpanel license. Unauthorized copying is prohibited

#
# This script removes any caches in /var/cpanel/configs.cache that are older then 7 days
#

my $TTL = ( 86400 * 7 );    # 7 days
my $now = time();

if ( !-d '/var/cpanel/configs.cache' ) {
    mkdir( '/var/cpanel/configs.cache', 0700 ) || die;
    exit; # Nothing in directory to purge, just bail
}

opendir my $cachefile_dir, '/var/cpanel/configs.cache';
my @cache_files = readdir $cachefile_dir;
closedir $cachefile_dir;

foreach my $cache_file (@cache_files) {
    if ( ( stat( '/var/cpanel/configs.cache/' . $cache_file ) )[9] + $TTL < $now ) {
        unlink( '/var/cpanel/configs.cache/' . $cache_file );
    }
}