GlisWeb framework
_src
_config
_135.postgresql.php
Vai alla documentazione di questo file.
1
<?php
2
15
// verifico che sia presente alemno un server
16
if
( isset(
$cf
[
'postgresql'
][
'profile'
][
'servers'
] ) && is_array(
$cf
[
'postgresql'
][
'profile'
][
'servers'
] ) && count(
$cf
[
'postgresql'
][
'profile'
][
'servers'
] ) > 0 ) {
17
18
// verifico che sia presente il modulo PostgreSQL
19
if
( function_exists(
'pg_connect'
) ) {
20
21
// ciclo sui server attivi per lo stato corrente
22
foreach
(
$cf
[
'postgresql'
][
'profile'
][
'servers'
] as $server ) {
23
24
// log
25
logWrite
(
'tento la connessione a: '
. $server,
'postgresql'
, LOG_DEBUG );
26
27
// connessione
28
$cn = pg_connect(
29
'host='
.
$cf
[
'postgresql'
][
'servers'
][ $server ][
'address'
].
30
' '
.
31
'port='
.
$cf
[
'postgresql'
][
'servers'
][ $server ][
'port'
].
32
' '
.
33
'dbname='
.
$cf
[
'postgresql'
][
'servers'
][ $server ][
'db'
].
34
' '
.
35
'user='
.
$cf
[
'postgresql'
][
'servers'
][ $server ][
'username'
].
36
' '
.
37
'password='
.
$cf
[
'postgresql'
][
'servers'
][ $server ][
'password'
]
38
);
39
40
$stat = pg_connection_status( $cn );
41
42
// controllo errori
43
if
( $stat !== PGSQL_CONNECTION_OK ) {
44
45
// log
46
logWrite
(
'errore di connessione'
,
'postgresql'
, LOG_ERR );
47
48
}
else
{
49
50
// log
51
logWrite
(
'connessione stabilita: '
. $server,
'postgresql'
, LOG_DEBUG );
52
53
// aggiungo la connessione all'array
54
$cf
[
'postgresql'
][
'connections'
][ $server ] = $cn;
55
56
}
57
58
}
59
60
// connessione di default
61
if
( count(
$cf
[
'postgresql'
][
'connections'
] ) ) {
62
$cf
[
'postgresql'
][
'connection'
] = ¤t(
$cf
[
'postgresql'
][
'connections'
] );
63
}
64
65
}
else
{
66
67
// log
68
logWrite
(
'libreria PostgreSQL non installata'
,
'postgresql'
, LOG_CRIT );
69
70
}
71
72
}
73
74
?>
logWrite
logWrite( $m, $f='site', $l=LOG_NOTICE, $d=DIRECTORY_LOG, $t=CURRENT_LOG_LEVEL, $s=SITE_STATUS)
scrive un messaggio nei log del sito
Definition:
_log.utils.php:48
$cf
$cf['ricerca']['template']
Definition:
_030.common.php:7
Generato Sab 25 Lug 2020 23:06:27 per GlisWeb framework da
1.8.13