Example #1
0
function enable_icap()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        echo basename(__FILE__) . ":Already executed pid {$pid}.. aborting the process\n";
        progress("{failed}", 110);
        return;
    }
    $sock = new sockets();
    $sock->SET_INFO("kavicapserverEnabled", 1);
    $MEM = $unix->MEM_TOTAL_INSTALLEE();
    if ($unix->MEM_TOTAL_INSTALLEE() < 624288) {
        $sock->SET_INFO("kavicapserverEnabled", 0);
        if ($GLOBALS["OUTPUT"]) {
            echo "Not enough memory - {$MEM}\n";
        }
        progress("{failed}", 110);
        return;
    }
    $q = new mysql_squid_builder();
    progress("{verify_icap_center}", 10);
    $q->CheckTablesICAP();
    if ($q->COUNT_ROWS("c_icap_services") == 0) {
        progress("{verify_icap_center} {failed}", 110);
    }
    progress("{hooking_local_service}", 10);
    $q->QUERY_SQL("UPDATE c_icap_services SET `enabled`=1 WHERE ID=6");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        progress("{hooking_local_service} {failed}", 110);
    }
    $q->QUERY_SQL("UPDATE c_icap_services SET `enabled`=1 WHERE ID=5");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        progress("{hooking_local_service} {failed}", 110);
    }
    progress("{reloading} {APP_KAV4PROXY}", 20);
    build();
    system("/etc/init.d/kav4proxy reload");
    progress("{configuring} {APP_SQUID}", 50);
    $php = $unix->LOCATE_PHP5_BIN();
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force --noverifcaches");
    progress("{restarting} {APP_SQUID}", 70);
    system("/etc/init.d/squid restart --force {$GLOBALS["SCRIPT_SUFFIX"]}");
    progress("{restarting} Artica-status", 80);
    system("/etc/init.d/artica-status restart --force");
    progress("{refresh} License", 90);
    $GLOBALS["FORCE"] = true;
    license_infos(true);
    progress("{success} {hooking_local_service}", 100);
}
Example #2
0
    exit;
}
if (isset($_GET["hook-local-service"])) {
    hook_local_service();
    exit;
}
if (isset($_GET["unhook-local-service"])) {
    unhook_local_service();
    exit;
}
if (isset($_GET["pattern-date"])) {
    kav4ProxyPatternDate();
    exit;
}
if (isset($_GET["license-infos"])) {
    license_infos();
    exit;
}
if (isset($_GET["is-installed"])) {
    is_installed();
    exit;
}
while (list($num, $line) = each($_GET)) {
    $f[] = "{$num}={$line}";
}
writelogs_framework("unable to understand query !!!!!!!!!!!..." . @implode(",", $f), "main()", __FILE__, __LINE__);
die;
function services_status()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();