« blib/lib/Lemonldap/NG/Common/Conf/Backends/Overlay.pm
↑ Summary
blib/lib/Lemonldap/NG/Common/Combination/Parser.pm »
| 1 | # @file | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Add get_key_from_all_sessions() function to Apache::Session modules. | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # This file is used by Lemonldap::NG::Manager::Status and by the | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # purgeCentralCache script. | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Warning, this works only with SQL databases, simple or Berkeley files (not | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # for Apache::Session::Memcached for example) | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | package Lemonldap::NG::Common::Apache::Session; | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use AutoLoader 'AUTOLOAD'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use Apache::Session; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use base qw(Apache::Session); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use Lemonldap::NG::Common::Apache::Session::Serialize::JSON; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Lemonldap::NG::Common::Apache::Session::Store; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use Lemonldap::NG::Common::Apache::Session::Lock; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 66 | our $VERSION = '2.19.0'; | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 270 | ▶ | sub _load { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load: called CC=4 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 270 | my ( $backend, $func ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 270 | ▶ | unless ( $backend->can('populate') ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | eval "require $backend"; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | die $@ if ($@); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 270 | ▶ | return $func ? $backend->can($func) : 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 197 | ▶ | sub populate { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
populate: called CC=11 SCAR=24.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 197 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 197 | my $backend = $self->{args}->{backend}; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 197 | _load($backend); | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 197 | $backend .= "::populate"; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 7 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 197 | $self = $self->$backend(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 197 | ▶ | if ( $backend =~ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ and not $self->{"args"}{"useStorable"}
MC/DC0%0/2
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ and not $self->{"args"}{"useStorable"}
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/
not $self->{"args"}{"useStorable"}
Truth table33%1/3
A and not(B)
A= $backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/B= not $self->{"args"}{"useStorable"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | and !$self->{args}->{useStorable} ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | $self->{serialize} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 197 | \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::serialize; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | $self->{unserialize} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 197 | \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserialize; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 197 | ▶ | if ( $backend =~ /^Apache::Session::LDAP/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | $self->{unserialize} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserializeBase64; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 197 | ▶ | if ( $self->{args}->{generateModule} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | my $generate = $self->{args}->{generateModule}; | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | eval "require $generate"; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | die $@ if ($@); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | $self->{generate} = \&{ $generate . "::generate" }; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | $self->{validate} = \&{ $generate . "::validate" }; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 197 | ▶ | if ( $self->{args}->{setId} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 13 | $self->{generate} = \&setId; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $self->{validate} = sub { 1 }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | my $allow_cache_for_root = ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | $self->{args}->{localStorageOptions} | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ? $self->{args}->{localStorageOptions}->{allow_cache_for_root} | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 197 | ▶ | : 0 | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # If cache is configured, use our specific object store module | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 197 | ▶ | if ( ( $> or $allow_cache_for_root ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$> || $allow_cache_for_root and $self->{"args"}{"localStorage"}
$> or $allow_cache_for_root
MC/DC33%1/3
$> || $allow_cache_for_root and $self->{"args"}{"localStorage"}
$>
$allow_cache_for_root
$self->{"args"}{"localStorage"}
Truth table40%2/5
A or B and C
A= $>B= $allow_cache_for_rootC= $self->{"args"}{"localStorage"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | and $self->{args}->{localStorage} ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 6 | $self->{args}->{object_store} = $self->{object_store}; | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | $self->{object_store} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 6 | Lemonldap::NG::Common::Apache::Session::Store->new($self); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | $self->{args}->{lock_manager} = $self->{lock_manager}; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | $self->{lock_manager} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | Lemonldap::NG::Common::Apache::Session::Lock->new($self); | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 197 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||