Changeset 792


Ignore:
Timestamp:
02/03/10 19:03:41 (14 years ago)
Author:
nanardon
Message:
  • avoid base reloading by using cache
  • add possible patch to avoid several base load (needing lot of tests)
Location:
LATMOS-Accounts
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ad.pm

    r775 r792  
    8787sub load { 
    8888    my ($self) = @_; 
     89 
     90    # If already load, just say ok ! 
     91    $self->{_ldap} and return 1; 
     92 
    8993    # At this point, if still no $server, DNS search 
    9094 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ldap.pm

    r288 r792  
    9898sub load { 
    9999    my ($self) = @_; 
    100     # At this point, if still no $server, DNS search 
     100 
     101    # If already loaded, just say ok ! 
     102    $self->{_ldap} and return 1; 
    101103 
    102104    my $ldapurl = $self->_ldap_url($self->{_server}); 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Mail.pm

    r488 r792  
    2828    my ($self) = @_; 
    2929 
     30    # If aleady loaded just say ok ! 
     31    $self->{_loaded} and return 1; 
     32 
    3033    # warning, comment will be strip ! 
    3134    if (open(my $handle, '<', $self->{file}{aliases})) { 
     35        $self->log(LA_DEBUG, "Reading file %s", $self->{file}{aliases}); 
    3236        while (my $line = <$handle>) { 
    3337            chomp($line); 
     
    4953 
    5054    if (open(my $handle, '<', $self->{file}{revaliases})) {  
     55        $self->log(LA_DEBUG, "Reading file %s", $self->{file}{revaliases}); 
    5156        while (my $line = <$handle>) { 
    5257            chomp($line); 
     
    6368        return; 
    6469    } 
     70 
     71    $self->{_loaded} = 1; 
    6572 
    6673    return 1; 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Unix.pm

    r784 r792  
    122122    my ($self, $file, $callback) = @_; 
    123123    open(my $handle, '<', $file) or do { 
    124         la_log(LA_ERR, "Cannot open unix file `%s' for reading (%s)", $file, $!); 
     124        $self->log(LA_ERR, "Cannot open unix file `%s' for reading (%s)", $file, $!); 
    125125        return; 
    126126    }; 
     127    $self->log(LA_DEBUG, "Reading file $file"); 
    127128    while (my $line = <$handle>) { 
    128129        chomp($line); 
     
    142143sub load { 
    143144    my ($self) = @_; 
     145 
     146    # If already loaded, just say ok ! 
     147    $self->{_loaded} and return 1; 
    144148     
    145149    $self->_load_unix_file( 
     
    227231 
    228232    } # use shadow ? 
     233 
     234    $self->{_loaded} = 1; 
    229235 
    230236    1; 
Note: See TracChangeset for help on using the changeset viewer.