MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/proc/self/root/scripts.20110531.215904.25158/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 );
    }
}