Ejemplo n.º 1
0
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . '/framework/class.settings.inc';
if (preg_match("#--verbose#", implode(" ", $argv))) {
    echo "VERBOSED....\n";
    $GLOBALS["VERBOSE"] = true;
    $GLOBALS["TRACE_INFLUX"] = true;
    $GLOBALS["OUTPUT"] = true;
    $GLOBALS["debug"] = true;
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    ini_set('error_prepend_string', null);
    ini_set('error_append_string', null);
}
if ($argv[1] == "--clean") {
    clean_tables();
    exit;
}
scan();
function scan()
{
    if (system_is_overloaded(basename(__FILE__))) {
        apache_admin_mysql(0, "Overloaded system, retry next time....", null, __FILE__, __LINE__);
        return;
    }
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        events("A process, {$pid} Already exists...");
<?php

/* Required files */
include_once 'definition.php';
include_once 'db.php';
$r = post_var('r');
$also_drop = post_var('also-drop');
if ($r == NULL) {
    die('ERInvalid parameters.');
}
$ok = true;
$ok &= clean_tables();
if ($also_drop != NULL) {
    $ok &= drop_user_tables();
}
if ($ok) {
    echo 'OKTable(s) cleaned and ready.';
} else {
    echo 'ERTable(s) cleaning failed.';
}
Ejemplo n.º 3
0
function execute()
{
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "cachetime:{$cachetime}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid)) {
        die;
    }
    $TimeEx = $unix->file_time_min($cachetime);
    if (!$GLOBALS["FORCE"]) {
        if ($TimeEx < 20) {
            return;
        }
    }
    $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer"));
    if ($EnableArticaMetaServer == 0) {
        return;
    }
    @unlink($cachetime);
    @file_put_contents($cachetime, time());
    @file_put_contents($pidfile, getmypid());
    scan_repos();
    scan_software_repo();
    extract_all_tgz();
    checkufdb();
    clean_tables();
}
Ejemplo n.º 4
0
function execute()
{
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $php5 = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    if ($GLOBALS["VERBOSE"]) {
        echo "cachetime:{$cachetime}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid)) {
        die;
    }
    $TimeEx = $unix->file_time_min($cachetime);
    if (!$GLOBALS["FORCE"]) {
        if ($TimeEx < 20) {
            return;
        }
    }
    $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer"));
    if ($EnableArticaMetaServer == 0) {
        return;
    }
    $ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage");
    if ($ArticaMetaStorage == null) {
        $ArticaMetaStorage = "/home/artica-meta";
    }
    @unlink($cachetime);
    @file_put_contents($cachetime, time());
    @file_put_contents($pidfile, getmypid());
    meta_stats();
    scan_repos();
    scan_softs();
    scan_software_repo();
    scan_categories();
    scan_temp_queue();
    extract_all_tgz();
    checkufdb();
    clean_tables();
    if (is_file("{$ArticaMetaStorage}/webfiltering/ufdbartica.txt")) {
        @unlink("/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer");
        @copy("{$ArticaMetaStorage}/webfiltering/ufdbartica.txt", "/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer");
        @chmod("/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer", 0755);
    }
    $cmd = trim("{$nohup} {$php5} /usr/share/artica-postfix/exec.artica-meta-squid-parser.php >/dev/null 2>&1 &");
    meta_events($cmd);
    shell_exec($cmd);
}