Don't failed if a module is missing

environments/ppa-mbqj77/deployments/1
Xavier Guimard 10 years ago
parent b23595a5e2
commit 007539b1f3
  1. 13
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
  2. 13
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm

@ -52,12 +52,21 @@ sub init {
map { push @links, $_; "Lemonldap::NG::Manager::" . ucfirst($_) }
split( /[,\s]+/, $self->{enabledModules} );
extends 'Lemonldap::NG::Handler::PSGI', @enabledModules;
my @working;
foreach my $mod (@enabledModules) {
no strict 'refs';
&{"${mod}::addRoutes"}($self);
if ( &{"${mod}::addRoutes"}($self) ) {
$self->lmLog( "Module $mod enabled", 'debug' );
push @working, $mod;
}
else {
$self->lmLog( "Module $mod can not be enabled: " . $self->error,
'error' );
}
}
return 0 unless (@working);
$self->defaultRoute( $enabledModules[0]->defaultRoute );
$self->defaultRoute( $working[0]->defaultRoute );
my $linksIcons =
{ 'conf' => 'cog', 'sessions' => 'duplicate', 'notifications' => 'bell' };

@ -26,7 +26,10 @@ use constant defaultRoute => 'notifications.html';
sub addRoutes {
my $self = shift;
return unless ( $self->notifAccess );
unless ( $self->notifAccess ) {
$self->addRoute( notifications => 'notEnabled' );
return ( $self->error ? 0 : 1 );
}
$self->{multiValuesSeparator} ||= '; ';
# HTML template
@ -66,8 +69,11 @@ sub notifAccess {
return $self->_notifAccess if ( $self->_notifAccess );
# 1. Get notificationStorage or build it using globalStorage
my $conf = $self->_confAcc->getConf()
or die($Lemonldap::NG::Common::Conf::msg);
my $conf = $self->_confAcc->getConf();
unless ($conf) {
$self->error($Lemonldap::NG::Common::Conf::msg);
return 0;
}
my $args;
# TODO: refresh system
@ -76,7 +82,6 @@ sub notifAccess {
qw/portal notification notificationStorage notificationStorageOptions/);
unless ( $self->{notification} ) {
$self->addRoute( notifications => 'notEnabled' );
return 0;
}

Loading…
Cancel
Save