Closes #189 "Cleanup process slows down considerably the Apache server"
This commit is contained in:
parent
13e86ea831
commit
de64f48d48
|
@ -219,6 +219,7 @@ install_bin: install_conf_dir
|
|||
# Binary install
|
||||
@install -v -d $(RBINDIR)
|
||||
@cp --preserve=mode --remove-destination \
|
||||
${SRCHANDLERDIR}/example/scripts/purgeLocalCache \
|
||||
${SRCPORTALDIR}/example/scripts/purgeCentralCache \
|
||||
${SRCPORTALDIR}/example/scripts/buildPortalWSDL \
|
||||
${SRCCOMMONDIR}/scripts/convertConfig \
|
||||
|
@ -355,6 +356,7 @@ install_handler_site: install_conf_dir
|
|||
@cp --remove-destination ${SRCHANDLERDIR}/example/MyHandlerZimbra.pm ${RHANDLERDIR}
|
||||
@cp --remove-destination ${SRCHANDLERDIR}/example/MyHandlerSympa.pm ${RHANDLERDIR}
|
||||
@cp --remove-destination ${SRCHANDLERDIR}/example/MyUpdateCookieHandler.pm ${RHANDLERDIR}
|
||||
@cp --remove-destination lemonldap-ng-handler/example/scripts/purgeLocalCache.cron.d $(RCRONDIR)/lemonldap-ng
|
||||
@rm -rf $$(find $(RHANDLERDIR) -type d -name .svn)
|
||||
|
||||
install_test_site:
|
||||
|
@ -575,6 +577,7 @@ debian-diff:
|
|||
@$(DIFF) lemonldap-ng-portal/example/cdc.pl $(DIFFPREFIX)/var/lib/lemonldap-ng/portal/cdc.pl ||true
|
||||
@# Handler
|
||||
@$(DIFF) lemonldap-ng-handler/lib/Lemonldap/NG/Handler $(DIFFPREFIX)/usr/share/perl5/Lemonldap/NG/Handler ||true
|
||||
@$(DIFF) lemonldap-ng-portal/example/scripts/purgeLocalCache $(DIFFPREFIX)/usr/share/lemonldap-ng/bin/purgeLocalCache ||true
|
||||
@# Common
|
||||
@$(DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common $(DIFFPREFIX)/usr/share/perl5/Lemonldap/NG/Common ||true
|
||||
@$(DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common.pm $(DIFFPREFIX)/usr/share/perl5/Lemonldap/NG/Common.pm ||true
|
||||
|
@ -604,6 +607,7 @@ default-diff:
|
|||
@$(DIFF) lemonldap-ng-handler/example/MyHandler.pm $(LMPREFIX)/handler/MyHandler.pm ||true
|
||||
@$(DIFF) lemonldap-ng-handler/example/MyHandlerZimbra.pm $(LMPREFIX)/handler/MyHandlerZimbra.pm ||true
|
||||
@$(DIFF) lemonldap-ng-handler/example/MyHandlerSympa.pm $(LMPREFIX)/handler/MyHandlerSympa.pm ||true
|
||||
@$(DIFF) lemonldap-ng-portal/example/scripts/purgeLocalCache $(LMPREFIX)/bin/purgeLocalCache ||true
|
||||
@# Common
|
||||
@$(DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common /usr/local/share/perl/5.10.0/Lemonldap/NG/Common ||true
|
||||
@$(DIFF) lemonldap-ng-common/lib/Lemonldap/NG/Common.pm /usr/local/share/perl/5.10.0/Lemonldap/NG/Common.pm ||true
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#
|
||||
# Regular cron jobs for the Lemonldap::NG portal
|
||||
#
|
||||
1 * * * * www-data test -x /usr/share/lemonldap-ng/bin/purgeLocalCache && /usr/share/lemonldap-ng/bin/purgeLocalCache
|
|
@ -1,3 +1,4 @@
|
|||
/usr/share/perl5/Lemonldap/NG/Handler*
|
||||
/usr/share/man/man3/Lemonldap::NG::Handler*
|
||||
/var/lib/lemonldap-ng/test
|
||||
/usr/share/lemonldap-ng/bin/purgeLocalCache
|
||||
|
|
|
@ -101,6 +101,7 @@ binary-indep: build install
|
|||
ln -s ../../liblemonldap-ng-manager-perl/examples manager && \
|
||||
ln -s ../../liblemonldap-ng-portal-perl/examples portal
|
||||
chmod +x debian/liblemonldap-ng-portal-perl$(LMSHAREDIR)bin/purgeCentralCache
|
||||
chmod +x debian/liblemonldap-ng-handler-perl$(LMSHAREDIR)bin/purgeLocalCache
|
||||
# dh_installmenu
|
||||
dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
|
|
@ -101,7 +101,8 @@ sub unserialize {
|
|||
$v =~ s/^'(.*)'$/$1/s;
|
||||
|
||||
# Manage hashes
|
||||
if ( $k =~ /^(?x:
|
||||
if (
|
||||
$k =~ /^(?x:
|
||||
applicationList
|
||||
|authChoiceModules
|
||||
|CAS_proxiedServices
|
||||
|
@ -124,8 +125,8 @@ sub unserialize {
|
|||
|samlSPMetaDataXML
|
||||
|samlStorageOptions
|
||||
)$/
|
||||
and $v ||= {}
|
||||
and not ref($v) )
|
||||
and $v ||= {} and not ref($v)
|
||||
)
|
||||
{
|
||||
$conf->{$k} = {};
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ example/MyHandlerLog4Perl.pm
|
|||
example/MyHandlerSympa.pm
|
||||
example/MyHandlerZimbra.pm
|
||||
example/MyUpdateCookieHandler.pm
|
||||
example/scripts/purgeLocalCache
|
||||
example/scripts/purgeLocalCache.cron.d
|
||||
lib/Lemonldap/NG/Handler.pm
|
||||
lib/Lemonldap/NG/Handler/AuthBasic.pm
|
||||
lib/Lemonldap/NG/Handler/CDA.pm
|
||||
|
|
38
modules/lemonldap-ng-handler/example/scripts/purgeLocalCache
Executable file
38
modules/lemonldap-ng-handler/example/scripts/purgeLocalCache
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/perl
|
||||
#=============================================================================
|
||||
# Cleaner for LemonLDAP::NG: purge local handler cache
|
||||
#
|
||||
# This module is written to be used by cron to clean old sessions from
|
||||
# Apache::Session. It does not works with Apache::Session::Memcached
|
||||
#
|
||||
# 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;
|
||||
exit 0 unless ( $conf->{localStorage} );
|
||||
eval "require $conf->{localStorage}";
|
||||
$conf->{localStorageOptions}->{namespace} ||= "lemonldap";
|
||||
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
|
||||
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
|
||||
$c->Purge();
|
||||
|
||||
exit 0;
|
|
@ -0,0 +1,4 @@
|
|||
#
|
||||
# Regular cron jobs for LemonLDAP::NG
|
||||
#
|
||||
1 * * * * __APACHEUSER__ [ -x __BINDIR__/purgeLocalCache ] && __BINDIR__/purgeLocalCache
|
|
@ -19,7 +19,8 @@ my $nb_purged = 0;
|
|||
#=============================================================================
|
||||
# Load configuration
|
||||
#=============================================================================
|
||||
my $lmconf = Lemonldap::NG::Common::Conf->new();
|
||||
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(PORTALSECTION)
|
||||
or die "Unable to get local configuration ($!)";
|
||||
|
|
Loading…
Reference in New Issue
Block a user