function repair_table_hour($xtime)
{
    if (!is_numeric($xtime)) {
        writelogs_repair($xtime, 100, "No timestamp set");
        return;
    }
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/repair_table_hour_{$xtime}.pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $squid_stats_tools = new squid_stats_tools();
    $squid_stats_tools->dansguardian_events_to_table_hour($xtime);
}
function Step2()
{
    $q = new mysql_squid_builder();
    percentage("Fix tables", 2);
    $q->FixTables();
    percentage("check_to_hour_tables", 2);
    $squid_stats_tools = new squid_stats_tools();
    $squid_stats_tools->check_to_hour_tables(true);
    percentage("not_categorized_day_scan", 2);
    $squid_stats_tools->not_categorized_day_scan();
}
Exemplo n.º 3
0
function restore_from_backup_statistics()
{
    $GLOBALS["VERBOSE"] = true;
    $squid_stats_tools = new squid_stats_tools();
    $squid_stats_tools->check_to_hour_tables();
    $squid_stats_tools->not_categorized_day_scan();
    ///home/artica/squid/backup-statistics
}
function StatsDaysTables()
{
    $unix = new unix();
    $min = 1440;
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "Time File: {$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($GLOBALS["FORCE"]) {
        ToSyslog("StatsDaysTables(): Executed in --force mode");
    }
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            ToSyslog("StatsDaysTables(): already executed pid {$pid}");
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < $min) {
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $q = new squid_stats_tools();
    $q->check_cachedays();
}