| 1 | package MPMinus::Configuration; # $Id: Configuration.pm 151 2013-05-29 14:31:19Z minus $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | MPMinus::Configuration - Configuration of MPMinus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | Version 1.33 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package MPM::foo::Handlers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub handler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | my $r = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | my $m = MPMinus->m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | $m->conf_init($r, __PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | my $project = $m->conf('project'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | The module works with the configuration data of the resource on the platform mod_perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | The configuration data are relevant at the global level, and they are the same for all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | users at once! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | =item B<conf_init> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $m->conf_init( $r, $pkg ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | =item B<conf, get_conf, config, get_config> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | my $value = $m->conf( 'key' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | =item B<set_conf, set_config> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | $m->set_conf( 'key', $value ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | =head1 HISTORY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =item B<1.00 / 27.02.2008> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Init version on base mod_main 1.00.0002 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =item B<1.10 / 01.04.2008> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | Module is merged into the global module level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =item B<1.20 / 19.04.2010> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | Added new type (DSN) support: Oracle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | =item B<1.30 / 08.01.2012> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | Added server_port variable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | =item B<1.31 / Wed Apr 24 14:53:38 2013 MSK> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | General refactoring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =item B<1.32 / Wed May 8 12:25:30 2013 MSK> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | Added locked_keys parameter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | Serz Minus (Lepenkov Sergey) L<http://serzik.ru> E<lt>minus@mail333.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | Copyright (C) 1998-2013 D&D Corporation. All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | See C<LICENSE> file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | ▶ | use CTK::Util qw/ :BASE /; # Óòèëèòàðèé | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | ▶ | use MPMinus::MainTools; # Ìîäóëü äëÿ äâóõ ôóíêöèé getHiTime è getSID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | ▶ | use Config::General; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | $VERSION = 1.33; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | sub conf_init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # Èíèöèàëèçàöèÿ. Çàïóñêàåòñÿ èç ãëàâíîãî õýíäëåðà!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $m = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conf_init: not called CC=48 SCAR=77.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | croak("The method call is made ActionCheck not in the style of OOP") unless ref($m) =~ /MPMinus/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $r = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | croak("Object Apache2::RequestRec not defined") unless ref($r) eq 'Apache2::RequestRec'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $pkg = shift || ''; # Ïàêåò, êîòîðûé âûçâàë èíèöèàëèçàöèþ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | croak("Package name missing!") unless $pkg && $pkg =~ /Handlers$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pkg and $pkg =~ /Handlers$/
MC/DC0%0/2
$pkg and $pkg =~ /Handlers$/
$pkg
$pkg =~ /Handlers$/
Truth table0%0/3
A and B
A= $pkgB= $pkg =~ /Handlers$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Óñòàíàâëèâàåì ãëàâííûé îáúåêò Apache2::RequestRec è çàâèñèìûå ïàêåòû | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $m->set(r => $r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $s = $r->server; # ñåðâåð | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $c = $r->connection; # Ñîåäèíåíèå | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # Âíóòðåííèé ìàññèâ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my %conf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ########################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # !!! Ïàðàìåòðû, óñòàíàâëèâàåìûå êàæäûé ïåðåçàïóñê !!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | ########################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # Ïàêåò äîëæåí âîçãëàâëÿòü ñïèñîê | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | my $i = $m->conf('package') ? ($m->conf('package')->[1] + 1) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $i = 1 if $i > 65534; # Íà ñëó÷àé ïåðåïîëíåíèÿ ñòåêà | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $conf{package} = [$pkg,$i]; # Ïîëíîå èìÿ ïàêåòà è êîëè÷åñòâî èíèöèàëèçàöèé çà äî÷êó. 0 - ïåðâûé ðàç | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # Äîîïðåäåëÿåì ïàðàìåòðû | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $conf{sid} = getSID(16,'m'); # ID Ñåññèè (SID) - Äëÿ êîíòðîëÿ ñåññèè | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $conf{hitime} = getHiTime(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # Îñíîâíûå çíà÷åíèÿ (ÍÅ ÐÅÄÀÊÒÈÐÓÅÌÛÅ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $prj = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ($pkg =~ /([^\:]+?)\:\:Handlers$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $prj = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $conf{project} = $prj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $conf{prefix} = lc($prj); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $conf{project} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $conf{prefix} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $conf{preffix} = $conf{prefix}; # Äëÿ îáðàòíîé ñîâìåñòèìîñòè ïîòîì óäàëèòü !! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # Ïåðåìåííûå "îêðóæåíèÿ" Apache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | $conf{request_uri} = $r->uri() || ""; # ïîëó÷åííàÿ GET ñòðîêà | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->uri || ''
MC/DC0%0/1
$r->uri || ''
$r->uri
Truth table0%0/2
A
A= $r->uri
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | $conf{request_method} = $r->method() || ""; # ïîëó÷åííàÿ ìåòîäà | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->method || ''
MC/DC0%0/1
$r->method || ''
$r->method
Truth table0%0/2
A
A= $r->method
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | $conf{remote_addr} = $c->remote_ip || ""; # IP êëèåíòà | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$c->remote_ip || ''
MC/DC0%0/1
$c->remote_ip || ''
$c->remote_ip
Truth table0%0/2
A
A= $c->remote_ip
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $conf{remote_user} = $r->user() || ""; # Èìÿ ïîëüçîâàòåëÿ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->user || ''
MC/DC0%0/1
$r->user || ''
$r->user
Truth table0%0/2
A
A= $r->user
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | $conf{server_admin} = $s->server_admin() || ""; # Àäðåñ ýëåêòðîííîé ïî÷òû | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$s->server_admin || ''
MC/DC0%0/1
$s->server_admin || ''
$s->server_admin
Truth table0%0/2
A
A= $s->server_admin
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | $conf{server_name} = $s->server_hostname() || ""; # Èìÿ ñåðâåðà (ãëàâíîãî õîñòà) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$s->server_hostname || ''
MC/DC0%0/1
$s->server_hostname || ''
$s->server_hostname
Truth table0%0/2
A
A= $s->server_hostname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | $conf{server_port} = $s->port() || 80; # Ïîðò ñåðâåðà (ãëàâíîãî õîñòà) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$s->port || 80
MC/DC0%0/1
$s->port || 80
$s->port
Truth table0%0/2
A
A= $s->port
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # HTTP_HOST = SERVER_NAME:SERVER_PORT if SERVER_PORT <> {80|443} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $conf{http_host} = $r->hostname() || ""; # Èìÿ õîñòà (âèðòóàëüíîãî õîñòà, îáðàùåíèÿ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->hostname || ''
MC/DC0%0/1
$r->hostname || ''
$r->hostname
Truth table0%0/2
A
A= $r->hostname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ($conf{server_port} != 80 and $conf{server_port} != 443 and $conf{server_name} eq $conf{http_host}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$conf{"server_port"} != 80 and $conf{"server_port"} != 443 and $conf{"server_name"} eq $conf{"http_host"}
$conf{"server_port"} != 80 and $conf{"server_port"} != 443
MC/DC0%0/3
$conf{"server_port"} != 80 and $conf{"server_port"} != 443 and $conf{"server_name"} eq $conf{"http_host"}
$conf{"server_port"} != 80
$conf{"server_port"} != 443
$conf{"server_name"} eq $conf{"http_host"}
Truth table0%0/4
A and B and C
A= $conf{"server_port"} != 80B= $conf{"server_port"} != 443C= $conf{"server_name"} eq $conf{"http_host"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $conf{http_host} = join ':', $conf{server_name}, $conf{server_port}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # ÀÁÑÎËÞÒÍÛÉ ïóòü îò êîðíÿ ñåðâåðà äî êîðíÿ ñàéòà. Áàçîâûé ïóòü äëÿ ðåñóðñà | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $conf{document_root} = $r->document_root || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->document_root || ''
MC/DC0%0/1
$r->document_root || ''
$r->document_root
Truth table0%0/2
A
A= $r->document_root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # ÀÁÑÎËÞÒÍÛÉ ïóòü îò êîðíÿ ñåðâåðà äî êîðíÿ modperl. Áàçîâûé ïóòü äëÿ modperl (îò íåãî îòòàëêèâàåìñÿ !!) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $conf{modperl_root} = $r->dir_config('ModperlRoot') || $conf{document_root}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$r->dir_config('ModperlRoot') || $conf{'document_root'}
MC/DC0%0/2
$r->dir_config('ModperlRoot') || $conf{'document_root'}
$r->dir_config('ModperlRoot')
$conf{'document_root'}
Truth table0%0/3
A || B
A= $r->dir_config('ModperlRoot')B= $conf{'document_root'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Ñïèñîê çàáëîêèðîâàííûõ êëþ÷åé | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my @locked_keys = keys %conf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Íå ïðîèçâîäèì äåéñòâèé â ñëó÷àå åñëè èíèöèàëèçàöèÿ âûçûâàåòñÿ íå ïåðâûé ðàç! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # Òî ÷òî ïîëó÷èëîñü çàêèäûâàåì â ãëîáàâëüíûé îáúåêò | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if ($i > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my %tconf = %{$m->get('conf')}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | foreach (keys %conf) { $tconf{$_} = $conf{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $m->set(conf=>{%tconf}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | return 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ########################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # !!! Ïàðàìåòðû, óñòàíàâëèâàåìûå òîëüêî 1 ðàç íà æèçíü âñåõ ïðîöåññîâ !!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ########################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $modperl_root = $conf{modperl_root}; # Ýòîò ïóòü äëÿ âñåõ óìîë÷àíèé !! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # Ôîðìèðóåì èìÿ êîíôèãóðàöèîííîãî ôàéëà. Íàïðèìåð, foo.conf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $conf{fileconf} = $r->dir_config('FileConf') || catfile($modperl_root,$conf{prefix}.".conf"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$r->dir_config('FileConf') || catfile($modperl_root, $conf{'prefix'} . '.conf')
MC/DC0%0/2
$r->dir_config('FileConf') || catfile($modperl_root, $conf{'prefix'} . '.conf')
$r->dir_config('FileConf')
catfile($modperl_root, $conf{'prefix'} . '.conf')
Truth table0%0/3
A || B
A= $r->dir_config('FileConf')B= catfile($modperl_root, $conf{'prefix'} . '.conf')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $conf{configloadstatus} = 0; # See _loadconfig | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # Îòíîñèòåëüíûå ïóòè ê äèðåêòîðèÿì (îòíîñèòåëüíî document_root) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $conf{dir_conf} = "conf"; # Äèðåêòîðèÿ ê ôàéëàì êîíôèãóðàöèè | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $conf{dir_logs} = "log"; # Äèðåêòîðèÿ ê ëîãàì îòíîñèòåëüíî document_root | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $conf{dir_cache} = "cache"; # Äèðåêòîðèÿ ê ôàéëàì êýøà | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $conf{dir_db} = "db"; # Äèðåêòîðèÿ ê ôàéëîâûì äàííûì | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $conf{dir_shtml} = "shtml"; # Äèðåêòîðèÿ ê ôàéëàì øàáëîíîâ è ôàéëîâ ssi | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # Àáñîëþòíûå ïóòè ê äèðåêòîðèÿì îòíîñèòåëüíî êîðíÿ ñåðâåðà (ÍÅ ÐÅÄÀÊÒÈÐÓÅÌÛÅ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my $logdir = syslogdir(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | unless (-e $logdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $logdir = catdir($modperl_root, $conf{dir_logs}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | preparedir($logdir) unless -e $logdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $conf{logdir} = $logdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $conf{confdir} = $r->dir_config('ConfDir') || catdir($modperl_root,$conf{dir_conf}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$r->dir_config('ConfDir') || catdir($modperl_root, $conf{'dir_conf'})
MC/DC0%0/2
$r->dir_config('ConfDir') || catdir($modperl_root, $conf{'dir_conf'})
$r->dir_config('ConfDir')
catdir($modperl_root, $conf{'dir_conf'})
Truth table0%0/3
A || B
A= $r->dir_config('ConfDir')B= catdir($modperl_root, $conf{'dir_conf'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # Èìåíà ôàëîâ (ÍÅ ÐÅÄÀÊÒÈÐÓÅÌÛÅ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # Ïðåôèêñíûå èìåíà ôàéëîâ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $fprefix = ($conf{prefix} ? ('mpminus-'.$conf{prefix}.'_') : 'mpminus-'); # Ïðåôèêñ èì¸í | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $conf{file_error} = $fprefix."error.log"; # Èìÿ ôàéëà îøèáîê (log) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $conf{file_debug} = $fprefix."debug.log"; # Èìÿ ôàéëà îòëàäêè (log) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $conf{file_connect} = $fprefix."connect.log"; # Èìÿ ôàéëà ñîåäèíåíèé ñ ÁÄ (log) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $conf{file_mail} = $fprefix."mail.log"; # Èìÿ ôàéëà ïèñåì (log) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $conf{file_mpminfo} = "mpminfo.shtml"; # Èìÿ ôàéëà øàáëîíà mpminfo (shtml) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # Àáñîëþòíûå ïóòè (ÍÅ ÐÅÄÀÊÒÈÐÓÅÌÛÅ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $conf{errorlog} = catfile($logdir,$conf{file_error}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $conf{debuglog} = catfile($logdir,$conf{file_debug}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # Áàçîâûå URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $urlsfx = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $urlpfx = 'http://'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | $urlsfx = ':'.$conf{server_port} if (1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | and $conf{server_port} != 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | and $conf{server_port} != 443 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | and $conf{http_host} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | and $conf{http_host} !~ /\:\d+$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$conf{"server_port"} != 80 and $conf{"server_port"} != 443 and $conf{"http_host"} and not $conf{"http_host"} =~ /\:\d+$/
$conf{"server_port"} != 80 and $conf{"server_port"} != 443 and $conf{"http_host"}
$conf{"server_port"} != 80 and $conf{"server_port"} != 443
MC/DC0%0/4
$conf{"server_port"} != 80 and $conf{"server_port"} != 443 and $conf{"http_host"} and not $conf{"http_host"} =~ /\:\d+$/
$conf{"server_port"} != 80
$conf{"server_port"} != 443
$conf{"http_host"}
not $conf{"http_host"} =~ /\:\d+$/
Truth table0%0/5
A and B and C and not(D)
A= $conf{"server_port"} != 80B= $conf{"server_port"} != 443C= $conf{"http_host"}D= not $conf{"http_host"} =~ /\:\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | $urlpfx = 'https://' if $conf{server_port} == 443; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $conf{url} = $urlpfx.$conf{http_host}.$urlsfx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $conf{urls} = "https://".$conf{http_host}.$urlsfx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $conf{url_shtml} = $conf{url}.'/'.$conf{dir_shtml}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $conf{urls_shtml} = $conf{urls}.'/'.$conf{dir_shtml}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # Ôëàãè (äèðåêòèâû ñ ïðåôôèêñîì è ñóôôèêñîì _ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | $conf{_debug_} = $r->dir_config('_debug_') || 0; # Ôëàã îòëàäêè | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('_debug_') || 0
MC/DC0%0/1
$r->dir_config('_debug_') || 0
$r->dir_config('_debug_')
Truth table0%0/2
A
A= $r->dir_config('_debug_')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | $conf{_errorsendmail_} = $r->dir_config('_errorsendmail_') || 0; # Ôëàã îòïðàâêè ñîîáùåíèÿ ïî ïî÷òå ïðè îøèáêàõ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('_errorsendmail_') || 0
MC/DC0%0/1
$r->dir_config('_errorsendmail_') || 0
$r->dir_config('_errorsendmail_')
Truth table0%0/2
A
A= $r->dir_config('_errorsendmail_')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $conf{_sendmail_} = $r->dir_config('_sendmail_') || 0; # Ôëàã îòïðàâêè ñîîáùåíèÿ (äëÿ âñåõ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('_sendmail_') || 0
MC/DC0%0/1
$r->dir_config('_sendmail_') || 0
$r->dir_config('_sendmail_')
Truth table0%0/2
A
A= $r->dir_config('_sendmail_')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | $conf{_syslog_} = $r->dir_config('_syslog_') || 0; # Ôëàã èñïîëüçîâàíèÿ Apache äëÿ îòðàáîòêè ôóíêöèé log è debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('_syslog_') || 0
MC/DC0%0/1
$r->dir_config('_syslog_') || 0
$r->dir_config('_syslog_')
Truth table0%0/2
A
A= $r->dir_config('_syslog_')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | push @locked_keys, qw/_debug_ _errorsendmail_ _sendmail_/; # áëîêèðóåì! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | push @locked_keys, grep {/dir|file|log|url/} keys(%conf); # áëîêèðóåì! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | push @locked_keys, qw/configloadstatus locked_keys/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $conf{locked_keys} = [sort(@locked_keys)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # SMTP (ïî÷òà) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | $conf{smtp_host} = $r->dir_config('smtp_host') || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('smtp_host') || ''
MC/DC0%0/1
$r->dir_config('smtp_host') || ''
$r->dir_config('smtp_host')
Truth table0%0/2
A
A= $r->dir_config('smtp_host')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $conf{smtp_user} = $r->dir_config('smtp_user') || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('smtp_user') || ''
MC/DC0%0/1
$r->dir_config('smtp_user') || ''
$r->dir_config('smtp_user')
Truth table0%0/2
A
A= $r->dir_config('smtp_user')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | $conf{smtp_password} = $r->dir_config('smtp_password') || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('smtp_password') || ''
MC/DC0%0/1
$r->dir_config('smtp_password') || ''
$r->dir_config('smtp_password')
Truth table0%0/2
A
A= $r->dir_config('smtp_password')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # Áàçà äàííûõ (ëþáàÿ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | for (qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | db_driver db_dsn db_host db_name db_port db_user db_password | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | db_timeout_connect db_timeout_request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | $conf{$_} = defined $r->dir_config($_) ? $r->dir_config($_) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # Áàçà äàííûõ MySQL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | for (qw/ db_mysql_host db_mysql_name db_mysql_user db_mysql_password /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | $conf{$_} = defined $r->dir_config($_) ? $r->dir_config($_) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # Áàçà äàííûõ Oracle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | for (qw/ db_oracle_host db_oracle_name db_oracle_user db_oracle_password /) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | $conf{$_} = defined $r->dir_config($_) ? $r->dir_config($_) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # ñòàíäàðòû âûâîäà è ïðî÷èå ïàðàìåòðû | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $conf{content_type} = $r->dir_config('content_type') || ''; # Äåôîëòíûé Content-type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$r->dir_config('content_type') || ''
MC/DC0%0/1
$r->dir_config('content_type') || ''
$r->dir_config('content_type')
Truth table0%0/2
A
A= $r->dir_config('content_type')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # Òî ÷òî ïîëó÷èëîñü çàêèäûâàåì â ãëîáàâëüíûé îáúåêò, ïðåäâàðèòåëüíî äîçàãðóçèâ äàííûå èç âíåøåíåé êîíôèãóðàöèè | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | _loadconfig(\%conf, @locked_keys); # ×òåíèå ôàéëà êîíôèãóðàöèè | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $m->set(conf=>{%conf}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | sub conf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # Ïðî÷èòàòü óêàçàííûé ïàðàìåòð êîíôèãóðàöèè | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conf: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | return undef unless $self->{conf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | return $self->{conf}->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub get_conf { goto &conf }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_conf: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | sub config { goto &conf }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub get_config { goto &conf }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_config: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | sub set_conf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # Óñòàíîâèòü óêàçàííûé ïàðàìåòð êîíôèãóðàöèè | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_conf: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | $self->{conf} = {} unless $self->{conf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->{conf}->{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | sub set_config { goto &set_conf }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_config: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | sub _loadconfig { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | my $lconf = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_loadconfig: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my @lkeys = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | return 0 unless $lconf && ref($lconf) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lconf and ref $lconf eq "HASH"
MC/DC0%0/2
$lconf and ref $lconf eq "HASH"
$lconf
ref $lconf eq "HASH"
Truth table0%0/3
A and B
A= $lconfB= ref $lconf eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return 0 unless $lconf->{fileconf} && -e $lconf->{fileconf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lconf->{"fileconf"} and -e $lconf->{"fileconf"}
MC/DC0%0/2
$lconf->{"fileconf"} and -e $lconf->{"fileconf"}
$lconf->{"fileconf"}
-e $lconf->{"fileconf"}
Truth table0%0/3
A and B
A= $lconf->{"fileconf"}B= -e $lconf->{"fileconf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # Ïûòàåìñÿ ïðî÷èòàòü êîíôèãóðàöèîííûå äàííûå | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $cfg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | $cfg = new Config::General( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | -ConfigFile => $lconf->{fileconf}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | -ConfigPath => [$lconf->{modperl_root}, $lconf->{confdir}], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | -ApacheCompatible => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | -LowerCaseNames => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | -AutoTrue => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | carp($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | my %newconfig = $cfg->getall if $cfg && $cfg->can('getall'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cfg and $cfg->can("getall")
MC/DC0%0/2
$cfg and $cfg->can("getall")
$cfg
$cfg->can("getall")
Truth table0%0/3
A and B
A= $cfgB= $cfg->can("getall")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $lconf->{configfiles} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | $lconf->{configfiles} = [$cfg->files] if $cfg && $cfg->can('files'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cfg and $cfg->can("files")
MC/DC0%0/2
$cfg and $cfg->can("files")
$cfg
$cfg->can("files")
Truth table0%0/3
A and B
A= $cfgB= $cfg->can("files")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # Çàïèñûâàåì òîëüêî ðàçðåøåííûå êëþ÷èêè | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | foreach my $k (keys(%newconfig)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | $lconf->{$k} = $newconfig{$k} if 1 == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | && $k | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | && !(grep {$_ eq $k} @lkeys) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$k and not grep({$_ eq $k;} @lkeys)
MC/DC0%0/2
$k and not grep({$_ eq $k;} @lkeys)
$k
not grep({$_ eq $k;} @lkeys)
Truth table0%0/3
A and not(B)
A= $kB= not grep({$_ eq $k;} @lkeys)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | $lconf->{configloadstatus} = 1 if %newconfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||