function tables_months()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "timefile={$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    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";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < 1240) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Only each 1240mn - current {$timeexec}mn, use --force to bypass\n";
            }
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Time File: {$timefile}\n";
    }
    @file_put_contents($timefile, time());
    if ($GLOBALS["VERBOSE"]) {
        echo "index_tables_day()\n";
    }
    if (!$GLOBALS["Q"]->ifStatisticsMustBeExecuted()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "This is not intended to build statistics - ifStatisticsMustBeExecuted -\n";
        }
        return;
    }
    table_year();
}
function Calculate_current_month()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/exec.squid.stats.month.php.Calculate_current_month.time";
    if ($GLOBALS["VERBOSE"]) {
        echo "time: {$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        return;
    }
    $timeFile = $unix->file_time_min($timefile);
    if ($timeFile < 1440) {
        return;
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $q = new mysql_squid_builder();
    $sql = "UPDATE tables_day SET year1=0 WHERE YEAR(zDate)=YEAR(NOW()) AND MONTH(zDate)=MONTH(NOW())";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        return;
    }
    $sql = "DELETE FROM allsizes WHERE YEAR(zDate)=YEAR(NOW()) AND MONTH(zDate)=MONTH(NOW())";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        return;
    }
    table_year();
}