You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
#!/usr/bin/perl
|
|
#=============================================================================
|
|
# Cleaner for LemonLDAP::NG: purge local handler cache and session cache
|
|
#
|
|
# This module is written to be used by cron to clean cache objects used
|
|
# by Handler.
|
|
#
|
|
# This is part of LemonLDAP::NG product, released under GPL
|
|
#=============================================================================
|
|
|
|
use Lemonldap::NG::Common::Conf;
|
|
use Lemonldap::NG::Common::Conf::Constants;
|
|
use strict;
|
|
|
|
my $debug = 0;
|
|
|
|
#=============================================================================
|
|
# Load configuration
|
|
#=============================================================================
|
|
my $lmconf = Lemonldap::NG::Common::Conf->new()
|
|
or die $Lemonldap::NG::Common::Conf::msg;
|
|
my $conf = $lmconf->getConf or die "Unable to get configuration ($!)";
|
|
my $localconf = $lmconf->getLocalConf(HANDLERSECTION)
|
|
or die "Unable to get local configuration ($!)";
|
|
|
|
if ($localconf) {
|
|
$conf->{$_} = $localconf->{$_} foreach ( keys %$localconf );
|
|
}
|
|
|
|
print "Configuration loaded\n" if $debug;
|
|
|
|
# Handler cache
|
|
if ( $conf->{localStorage} ) {
|
|
eval "require $conf->{localStorage}";
|
|
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
|
|
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
|
|
$c->purge();
|
|
}
|
|
|
|
# Session cache
|
|
if ( $conf->{localSessionStorage} ) {
|
|
eval "require $conf->{localSessionStorage}";
|
|
$conf->{localSessionStorageOptions}->{default_expires_in} ||= 600;
|
|
my $s =
|
|
$conf->{localSessionStorage}->new( $conf->{localSessionStorageOptions} );
|
|
$s->purge();
|
|
}
|
|
|
|
exit 0;
|
|
|