Manage configuration number increment (#649)

This commit is contained in:
Clément Oudot 2014-01-23 14:05:18 +00:00
parent 8138389344
commit 2f48732a18
2 changed files with 20 additions and 5 deletions

View File

@ -37,7 +37,11 @@ giveUpPrivileges( "www-data", "www-data" );
my ( $cli, $action, $method, $ret );
$cli = new Lemonldap::NG::Manager::Cli;
$cli = new Lemonldap::NG::Manager::Cli;
# Do not increment configuration by default
$cli->{confAccess}->{cfgNumFixed} = 1;
$action = shift(@ARGV);
$method = $cli->determineMethod($action);

View File

@ -35,7 +35,7 @@ sub new {
## @method int saveConf ()
# Save LemonLDAP::NG configuration
#
# @return Configuration identifier.
# @return Configuration identifier
sub saveConf {
my ($self) = @_;
@ -43,13 +43,23 @@ sub saveConf {
$self->{conf}->{cfgAuthorIP} = "127.0.0.1";
$self->{conf}->{cfgDate} = time();
# Do not increment configuration number
$self->{conf}->{cfgNumFixed} = 1;
my $ret = $self->{confAccess}->saveConf( $self->{conf} );
return $ret;
}
## @method int increment ()
# Force increment of configuration number
#
# @return nothing
sub increment {
my ($self) = @_;
$self->{confAccess}->{cfgNumFixed} = 0;
$self->{confModified} = 1;
return;
}
## @method string determineMethod ()
# Determine the method from the arguments
#
@ -1033,6 +1043,7 @@ Global actions
lemonldap-ng-cli help - display this message
lemonldap-ng-cli info - show current configuration information
lemonldap-ng-cli increment - save current configuration into a new one
Simple parameters (key/value form)
==================================