Exemplo n.º 1
0
function parse_hours()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if (!$GLOBALS["VERBOSE"]) {
        if ($unix->file_time_min($pidTime) < 60) {
            return;
        }
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $sock = new sockets();
    $EnableNginxStats = $sock->GET_INFO("EnableNginxStats");
    if (!is_numeric($EnableNginxStats)) {
        $EnableNginxStats = 0;
    }
    if ($EnableNginxStats == 0) {
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        events("Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} aborting", __FUNCTION__, __LINE__);
        return;
    }
    $FALSES["information_schema"] = true;
    $FALSES["mysql"] = true;
    $q = new nginx_stats();
    $DATABASE_LIST_SIMPLE = $q->DATABASE_LIST_SIMPLE();
    while (list($db, $b) = each($DATABASE_LIST_SIMPLE)) {
        if (isset($FALSES[$db])) {
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Parsing database {$db}\n";
        }
        parse_database($db);
    }
}
Exemplo n.º 2
0
function parse_multi_databases()
{
    $sock = new sockets();
    $uuid = base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes"));
    $sql = "SELECT ValueTEXT,ip_address,ou FROM postfix_multi WHERE `key`='PluginsEnabled' AND uuid='{$uuid}'";
    if ($GLOBALS["DEBUG"]) {
        echo "{$sql}\n";
    }
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo __FUNCTION__ . " {$q->mysql_error}\n";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $array_filters = unserialize(base64_decode($ligne["ValueTEXT"]));
        if ($GLOBALS["DEBUG"]) {
            echo "{$ligne["ip_address"]} APP_MILTERGREYLIST ->{$array_filters["APP_MILTERGREYLIST"]}  \n";
        }
        if ($array_filters["APP_MILTERGREYLIST"] == null) {
            continue;
        }
        if ($array_filters["APP_MILTERGREYLIST"] == 0) {
            continue;
        }
        $hostname = MultiplesInstancesGetmyhostname($ligne["ip_address"]);
        $ou = $ligne["ou"];
        if ($GLOBALS["DEBUG"]) {
            echo "{$hostname} -> {$ou}\n";
        }
        $GLOBALS["hostnames"][$hostname] = $ou;
        $file = "/var/milter-greylist/{$hostname}/greylist.db";
        parse_database($file, $hostname);
    }
}