mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
In the service reconnect to the database only when needed
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
if (file_exists($file)) {
|
||||
$pid = file_get_contents($file);
|
||||
if (function_exists('posix_getsid')) {
|
||||
if (posix_getsid($pid) === false) {
|
||||
if (posix_getsid($pid) === false) {
|
||||
//process is not running
|
||||
$exists = false;
|
||||
}
|
||||
@@ -136,6 +136,15 @@
|
||||
//get the messages waiting in the fax queue
|
||||
while (true) {
|
||||
|
||||
//connect to the database if needed
|
||||
if (!$database->is_connected()) {
|
||||
$database->connect();
|
||||
if (!$database->is_connected()) {
|
||||
sleep(3);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//get the fax messages that are waiting to send
|
||||
$sql = "select * from v_fax_queue ";
|
||||
$sql .= "where hostname = :hostname ";
|
||||
@@ -164,7 +173,6 @@
|
||||
echo $sql."\n";
|
||||
print_r($parameters);
|
||||
}
|
||||
$database = new database;
|
||||
$fax_queue = $database->select($sql, $parameters, 'all');
|
||||
unset($parameters);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user