DBI module deprecated

This commit is contained in:
Xavier Guimard 2010-01-01 12:04:26 +00:00
parent 5a5d3872fd
commit 715460b108
4 changed files with 40 additions and 27 deletions

View File

@ -13,28 +13,34 @@ use constant UNKNOWN_ERROR => -2;
use constant DATABASE_LOCKED => -3;
use constant UPLOAD_DENIED => -4;
use constant SYNTAX_ERROR => -5;
use constant DEFAULTCONFFILE => "/usr/local/lemonldap-ng/etc/lemonldap-ng.ini";
use constant DEFAULTSECTION => "all";
use constant CONFSECTION => "configuration";
use constant PORTALSECTION => "portal";
use constant HANDLERSECTION => "handler";
use constant MANAGERSECTION => "manager";
use constant APPLYSECTION => "apply";
use constant DEPRECATED => -6;
use constant DEFAULTCONFFILE => "/usr/local/lemonldap-ng/etc/lemonldap-ng.ini";
use constant DEFAULTSECTION => "all";
use constant CONFSECTION => "configuration";
use constant PORTALSECTION => "portal";
use constant HANDLERSECTION => "handler";
use constant MANAGERSECTION => "manager";
use constant APPLYSECTION => "apply";
our %EXPORT_TAGS = ( 'all' => [ qw(
CONFIG_WAS_CHANGED
UNKNOWN_ERROR
DATABASE_LOCKED
UPLOAD_DENIED
SYNTAX_ERROR
DEFAULTCONFFILE
DEFAULTSECTION
CONFSECTION
PORTALSECTION
HANDLERSECTION
MANAGERSECTION
APPLYSECTION
) ] );
our %EXPORT_TAGS = (
'all' => [
qw(
CONFIG_WAS_CHANGED
UNKNOWN_ERROR
DATABASE_LOCKED
UPLOAD_DENIED
SYNTAX_ERROR
DEPRECATED
DEFAULTCONFFILE
DEFAULTSECTION
CONFSECTION
PORTALSECTION
HANDLERSECTION
MANAGERSECTION
APPLYSECTION
)
]
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

View File

@ -2,7 +2,7 @@ package Lemonldap::NG::Common::Conf::DBI;
use strict;
use DBI;
use Lemonldap::NG::Common::Conf::Constants; #inherits
use Lemonldap::NG::Common::Conf::Constants; #inherits
use Lemonldap::NG::Common::Conf::Serializer;
our $VERSION = 0.17;
@ -79,6 +79,7 @@ sub unlock {
sub store {
my ( $self, $fields ) = @_;
return DEPRECATED unless ( $self->{forceUpload} );
$fields = $self->serialize($fields);
my $tmp =
$self->dbh->do( "insert into "

View File

@ -172,11 +172,11 @@ sub confUpload {
if ( $errors->{result}->{cfgNum} > 0 ) {
# Store accounting datas to the response
$errors->{cfgDatas} = {
cfgAuthor => $newConf->{cfgAuthor},
cfgAuthorIP => $newConf->{cfgAuthorIP},
cfgDate => $newConf->{cfgDate}
};
$errors->{cfgDatas} = {
cfgAuthor => $newConf->{cfgAuthor},
cfgAuthorIP => $newConf->{cfgAuthorIP},
cfgDate => $newConf->{cfgDate}
};
$msg = 'confSaved';
# Log success using Lemonldap::NG::Common::CGI::userNotice():
@ -195,6 +195,7 @@ sub confUpload {
DATABASE_LOCKED, 'databaseLocked',
UPLOAD_DENIED, 'uploadDenied',
SYNTAX_ERROR, 'syntaxError',
DEPRECATED, 'confModuledeprecated',
}->{ $errors->{result}->{cfgNum} };
# Log failure using Lemonldap::NG::Common::CGI::userError()
@ -210,6 +211,9 @@ sub confUpload {
$errors->{result}->{other} = '<a href="javascript:uploadConf(1)">'
. $self->translate('clickHereToForce') . '</a>';
}
elsif ( $errors->{result}->{cfgNum} == DEPRECATED ) {
$errors->{result}->{other} = 'Module : ' . $self->confObj->{type};
}
}
# 3. PREPARE JSON RESPONSE

View File

@ -52,6 +52,7 @@ sub en {
authParams => 'Authentication parameters',
clickHereToForce => 'Click here to force',
Configuration => 'Configuration',
confModuledeprecated => 'This module has been deprecated, set "forceUpload=1" in lemonldap-ng.ini to use it',
confSaved => 'Configuration saved',
confWasChanged => 'Configuration has been changed',
cookieExpiration => 'Cookie expiration time',
@ -117,6 +118,7 @@ sub fr {
authParams => "Paramètres d'authentification",
clickHereToForce => 'Clicker ici pour forcer',
Configuration => 'Configuration',
confModuledeprecated => "Ce module est obsolète, indiquez \"forceUpload=1\" dans le fichier lemonldap-ng.ini pour l'utiliser",
confSaved => 'Configuration sauvegardée',
confWasChanged => 'Configuration modifiée entre-temps',
cookieExpiration => 'Durée de vie du cookie',