From 715460b10895b16fff3a37395b1524530d88ee26 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Fri, 1 Jan 2010 12:04:26 +0000 Subject: [PATCH] DBI module deprecated --- .../lib/Lemonldap/NG/Common/Conf/Constants.pm | 48 +++++++++++-------- .../lib/Lemonldap/NG/Common/Conf/DBI.pm | 3 +- .../lib/Lemonldap/NG/Manager/Uploader.pm | 14 ++++-- .../lib/Lemonldap/NG/Manager/_i18n.pm | 2 + 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm index d14507ccc..375de7f86 100644 --- a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm +++ b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm @@ -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'} } ); diff --git a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DBI.pm b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DBI.pm index dfe13fffe..ef31cc34a 100644 --- a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DBI.pm +++ b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DBI.pm @@ -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 " diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm index e59814b9c..0cb195ec2 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm @@ -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} = '' . $self->translate('clickHereToForce') . ''; } + elsif ( $errors->{result}->{cfgNum} == DEPRECATED ) { + $errors->{result}->{other} = 'Module : ' . $self->confObj->{type}; + } } # 3. PREPARE JSON RESPONSE diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm index a038aaa7b..fab95bc22 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm @@ -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',