function unlock_ufdbguard_artica()
{
    $dbfile = "/var/log/squid/ufdbgclient.unlock.db";
    $unix = new unix();
    $q = new mysql_squid_builder();
    $RESET = false;
    $Count = $q->COUNT_ROWS("ufdbunlock");
    $q->QUERY_SQL("DELETE FROM ufdbunlock WHERE finaltime <" . time());
    $Count2 = $q->COUNT_ROWS("ufdbunlock");
    if ($Count2 != $Count) {
        $RESET = TRUE;
    }
    if ($GLOBALS["RELOAD"]) {
        $RESET = TRUE;
    }
    $sql = "SELECT * FROM ufdbunlock WHERE finaltime > " . time();
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
    }
    @unlink($dbfile);
    echo "berekley_db:: Creating {$dbfile} database\n";
    $db_desttmp = @dba_open($dbfile, "c", "db4");
    @dba_close($db_desttmp);
    if (!is_file($dbfile)) {
        squid_admin_mysql(2, "berekley_db::FATAL ERROR", $dbfile, __FILE__, __LINE__);
        return;
    }
    $db_con = @dba_open($dbfile, "c", "db4");
    echo mysql_num_rows($results) . " Rows... {$sql}\n";
    while ($ligne = mysql_fetch_assoc($results)) {
        $md5 = $ligne["md5"];
        $finaltime = $ligne["finaltime"];
        $uid = $ligne["uid"];
        $ipaddr = $ligne["ipaddr"];
        $www = $ligne["www"];
        if ($GLOBALS["VERBOSE"]) {
            echo "***** {$md5} {$www} {$ipaddr}******\n";
        }
        unlock_events("{$md5} {$www} {$ipaddr} > {$finaltime}");
        $array["finaltime"] = $finaltime;
        $array["uid"] = $uid;
        $array["ipaddr"] = $ipaddr;
        $array["www"] = $www;
        @dba_replace($md5, serialize($array), $db_con);
    }
    @dba_close($db_con);
    if ($RESET) {
        $php = $unix->LOCATE_PHP5_BIN();
        shell_exec("{$php} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
        unlock_events("{$php} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
    }
}
示例#2
0
function reconfigure_unlock()
{
    $unix = new unix();
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    writelogs_framework("{$nohup} {$php} /usr/share/artica-postfix/exec.ufdb.queue.release.php --force --reload", __FUNCTION__, __FILE__, __LINE__);
    unlock_events("{$nohup} {$php} /usr/share/artica-postfix/exec.ufdb.queue.release.php --force --reload");
    shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.ufdb.queue.release.php --force --reload");
}