Example #1
0
                echo "Cannot setup notify listener. Polling.\n";
            }
            $notify_mode = false;
        }
    }
    while ($do_loop) {
        if ($verbose > 2) {
            echo "Mailer awaken.\n";
        }
        if (!Send_Mails($verbose, $dry_run)) {
            if ($verbose > 1) {
                echo "Mail sending failed.\n";
            }
        }
        if ($notify_mode) {
            if (pg_wait_notify($dbh->_connectionID, 300000) === false) {
                // TODO: check more thoroughly
                echo "Wait failed, db connection broken?\n";
                break;
            }
            if (($nots = pg_get_notify($dbh->_connectionID)) !== false) {
                if ($verbose > 2) {
                    print_r($nots);
                }
            }
            //break;
        } else {
            sleep(300);
        }
    }
} else {
Example #2
0
    }
}
if (false) {
    require_once 'Class.A2Billing.inc.php';
    $dbh = A2Billing::DBHandle();
    // Execute a query with some results and some warnings..
    $res = $dbh->Execute('SELECT * from RateEngine2(1,\'+7831222\',now(),-1);');
    echo "Msg:" . print_r($dbh->ErrorMsg(), true) . "\n";
    echo "Msg 2:" . print_r($dbh->NoticeMsg(), true) . "\n";
    print_r($res->GetAll());
    //print_r($dbh);
}
if (false) {
    require_once 'Class.A2Billing.inc.php';
    $dbh = A2Billing::DBHandle();
    print_r($dbh);
}
if (false) {
    require_once 'Class.A2Billing.inc.php';
    $dbh = A2Billing::DBHandle();
    echo "Connected!\n";
    $dbh->Execute("LISTEN test;");
    pg_wait_notify($dbh->_connectionID, 30000);
    echo "Done!\n";
}
if (true) {
    require "../A2Billing_AGI/groupdial.inc.php";
    echo "Result:";
    print_r(groupstr_analyze($argv[1]));
    echo "\n";
}