Пример #1
0
function logsize($uuid, $ipaddr, $hostname, $file, $size)
{
    $time = time();
    $key = md5("{$uuid}{$size}{$file}{$time}{$ipaddr}");
    writelogs_stats("{$uuid},{$ipaddr},{$hostname},{$file},{$size}", __FUNCTION__, __FILE__, __LINE__);
    $DatabasePath = "/usr/share/artica-postfix/ressources/conf/STATSAPPUPLD_" . date("Ymdi") . ".db";
    if (!berekley_db_create($DatabasePath)) {
        writelogs_meta("Fatal: Creating {$DatabasePath}", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $db_con = @dba_open($DatabasePath, "c", "db4");
    $ARRAY["UUID"] = $uuid;
    $ARRAY["IPADDR"] = $ipaddr;
    $ARRAY["HOSTNAME"] = $hostname;
    $ARRAY["SIZE"] = $size;
    $ARRAY["FILE"] = $file;
    $ARRAY["TIME"] = time();
    dba_replace($key, base64_encode(serialize($ARRAY)), $db_con);
    @dba_close($db_con);
}
Пример #2
0
function pfx()
{
    $CommonName = $_GET["pfx"];
    $q = new mysql();
    $sql = "SELECT pks12  FROM sslcertificates WHERE CommonName='{$CommonName}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $data = $ligne["pks12"];
    $fsize = strlen($data);
    writelogs_meta("{$CommonName} -> Send {$fsize}Bytes to client", __FUNCTION__, __FILE__, __LINE__);
    header('Content-type: application/x-pkcs12');
    header('Content-Transfer-Encoding: binary');
    header("Content-Disposition: attachment; filename=\"{$CommonName}.pfx\"");
    header("Pragma: public");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date dans le passé
    header("Content-Length: " . $fsize);
    ob_clean();
    flush();
    echo $data;
}
Пример #3
0
function ufdbtables_artica_meta()
{
    $unix = new unix();
    $WORKDIR = $GLOBALS["WORKDIR_LOCAL"];
    @mkdir($WORKDIR, 0755, true);
    @chmod($WORKDIR, 0755);
    $tmpdir = $unix->TEMP_DIR();
    $myVersion = intval(@file_get_contents("/etc/artica-postfix/ufdbartica.txt"));
    $meta = new artica_meta();
    $curl = $meta->buildCurl("/meta-updates/webfiltering/ufdbartica.txt");
    if (!$curl->GetFile("{$tmpdir}/ufdbartica.txt")) {
        artica_update_event(0, "Failed Downloading {$meta->LOG_URI}", @implode("\n", $curl->errors), __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed Downloading {$meta->LOG_URI}", @implode("\n", $curl->errors), __FILE__, __LINE__);
        return false;
    }
    if (!is_file("/etc/artica-postfix/artica-webfilter-db-index.txt")) {
        $curl = $meta->buildCurl("/meta-updates/webfiltering/index.txt");
        if (!$curl->GetFile("/etc/artica-postfix/artica-webfilter-db-index.txt")) {
            artica_update_event(0, "Failed Downloading webfiltering/index.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
            meta_admin_mysql(0, "Failed Downloading webfiltering/index.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
        }
    }
    if (!is_file("/etc/artica-postfix/ufdbcounts.txt")) {
        $curl = $meta->buildCurl("/meta-updates/webfiltering/ufdbcounts.txt");
        if (!$curl->GetFile("/etc/artica-postfix/ufdbcounts.txt")) {
            artica_update_event(0, "Failed Downloading webfiltering/ufdbcounts.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
            meta_admin_mysql(0, "Failed Downloading webfiltering/ufdbcounts.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
        }
    }
    $Remote_version = intval(@file_get_contents("{$tmpdir}/ufdbartica.txt"));
    echo "Current............: {$myVersion}\n";
    echo "Available..........: {$Remote_version}\n";
    $Remote_versionTime = date("Y-m-d H:i:s", $Remote_version);
    $rm = $unix->find_program("rm");
    $cat = $unix->find_program("cat");
    $tar = $unix->find_program("tar");
    if ($myVersion == $Remote_version) {
        echo "My version {$myVersion} is the same than {$Remote_version} {$Remote_versionTime}, aborting\n";
        return;
    }
    if ($myVersion > $Remote_version) {
        echo "My version {$myVersion} is newest than {$Remote_version} {$Remote_versionTime}, aborting\n";
        return;
    }
    $curl = $meta->buildCurl("/meta-updates/webfiltering/ufdbartica/ufdbartica.txt");
    //***************************************************************************************************************
    if ($curl->GetFile("{$tmpdir}/ufdbartica.txt")) {
        $ufdbartica_tmp = "{$tmpdir}/ufdbartica_tmp";
        @mkdir($ufdbartica_tmp, 0755, true);
        $splitted = unserialize(@file_get_contents("{$tmpdir}/ufdbartica.txt"));
        if (is_array($splitted)) {
            if (count($splitted) > 2) {
                while (list($targetFile, $md5file) = each($ARRAY)) {
                    $BaseName = basename($targetFile);
                    $HTTP_LINK = "/meta-updates/webfiltering/ufdbartica/{$BaseName}";
                    $LOCAL_FILE = "{$ufdbartica_tmp}/{$BaseName}";
                    writelogs_meta("Checking {$LOCAL_FILE}", __FUNCTION__, __FILE__, __LINE__);
                    if (is_file($LOCAL_FILE)) {
                        $md5Local = md5_file($LOCAL_FILE);
                        if ($md5Local == $md5file) {
                            continue;
                        }
                        writelogs_meta("{$LOCAL_FILE} corrupted...", __FUNCTION__, __FILE__, __LINE__);
                        @unlink($LOCAL_FILE);
                    }
                    writelogs_meta("Downloading {$HTTP_LINK}", __FUNCTION__, __FILE__, __LINE__);
                    $curl = $meta->buildCurl($HTTP_LINK);
                    if (!$curl->GetFile($LOCAL_FILE)) {
                        writelogs_meta("Unable to download {$HTTP_LINK} {$curl->error}\n" . @implode("\n", $curl->errors), __FUNCTION__, __FILE__, __LINE__);
                        return true;
                    }
                    $md5Local = md5_file($LOCAL_FILE);
                    if ($md5Local == $md5file) {
                        writelogs_meta("{$HTTP_LINK} success...", __FUNCTION__, __FILE__, __LINE__);
                        continue;
                    }
                }
                system("{$cat} {$ufdbartica_tmp}/*.tgz.* >{$tmpdir}/ufdbartica.tgz");
            }
        }
    }
    //***************************************************************************************************************
    @unlink("{$tmpdir}/ufdbartica.txt");
    if (!is_file("{$tmpdir}/ufdbartica.tgz")) {
        $curl = $meta->buildCurl("/meta-updates/webfiltering/ufdbartica.tgz");
        if (!$curl->GetFile("{$tmpdir}/ufdbartica.tgz")) {
            artica_update_event(0, "Failed Downloading webfiltering/ufdbartica.tgz", @implode("\n", $curl->errors), __FILE__, __LINE__);
            meta_admin_mysql(0, "Failed Downloading webfiltering/ufdbartica.tgz", @implode("\n", $curl->errors), __FILE__, __LINE__);
            @unlink("{$tmpdir}/ufdbartica.tgz");
            return false;
        }
    }
    $curl = $meta->buildCurl("/meta-updates/webfiltering/index.txt");
    if (!$curl->GetFile("/etc/artica-postfix/artica-webfilter-db-index.txt")) {
        artica_update_event(0, "Failed Downloading webfiltering/index.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed Downloading webfiltering/index.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
    }
    $curl = $meta->buildCurl("/meta-updates/webfiltering/ARTICAUFDB_LAST_DOWNLOAD");
    $curl->GetFile("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD");
    $STATUS = unserialize(@file_get_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD"));
    $STATUS["LAST_DOWNLOAD"]["LAST_CHECK"] = time();
    @file_put_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD", serialize($STATUS));
    if (!$unix->TARGZ_TEST_CONTAINER("{$tmpdir}/ufdbartica.tgz")) {
        artica_update_event(0, "Failed {$tmpdir}/ufdbartica.tgz corrupted package", @implode("\n", $curl->errors), __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed {$tmpdir}/ufdbartica.tgz corrupted package", @implode("\n", $curl->errors), __FILE__, __LINE__);
        @unlink("{$tmpdir}/ufdbartica.tgz");
        return false;
    }
    @file_put_contents("/etc/artica-postfix/ufdbartica.txt", $Remote_version);
    $tar = $unix->find_program("tar");
    $php5 = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$tar} -xf {$tmpdir}/ufdbartica.tgz -C {$WORKDIR}/");
    @unlink("{$tmpdir}/ufdbartica.tgz");
    if (!is_file("/opt/ufdbcat/bin/ufdbcatdd")) {
        system("{$php5} /usr/share/artica-postfix/exec.ufdbcat.php --install --noupdate");
    }
    shell_exec("/etc/init.d/ufdbcat reload");
    artica_update_event(0, "Success Artica Webfiltering databases v.{$Remote_version}", @implode("\n", $curl->errors), __FILE__, __LINE__);
    meta_admin_mysql(0, "Success Artica Webfiltering databases v.{$Remote_version}", @implode("\n", $curl->errors), __FILE__, __LINE__);
    updatev2_progress(100, "{done} [" . __LINE__ . "]");
}
Пример #4
0
function ident()
{
    if (isset($_SERVER["REMOTE_ADDR"])) {
        $IPADDR = $_SERVER["REMOTE_ADDR"];
    }
    if (isset($_SERVER["HTTP_X_REAL_IP"])) {
        $IPADDR = $_SERVER["HTTP_X_REAL_IP"];
    }
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        $IPADDR = $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    $GLOBALS["CLIENT_META_IP"] = $IPADDR;
    $sock = new sockets();
    $ARRAY = unserialize(base64_decode($_GET["ident"]));
    $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer"));
    $ArticaMetaServerUsername = trim(strtolower($sock->GET_INFO("ArticaMetaServerUsername")));
    $ArticaMetaServerPassword = $sock->GET_INFO("ArticaMetaServerPassword");
    if ($EnableArticaMetaServer == 0) {
        die;
    }
    $UUID = $ARRAY["uuid"];
    $GLOBALS["UUID"] = $UUID;
    $hostname = $ARRAY["hostname"];
    $version = $ARRAY["version"];
    $username = trim(strtolower($ARRAY["username"]));
    $password = $ARRAY["password"];
    if ($ArticaMetaServerUsername != $username) {
        writelogs_meta("Checking identification FROM {$IPADDR} failed, wrong username or password", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    if ($ArticaMetaServerPassword != $password) {
        writelogs_meta("Checking identification FROM {$IPADDR} failed, wrong username or password", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    $q = new mysql_meta();
    if (!$q->TABLE_EXISTS("metahosts")) {
        if (!$q->CheckTables()) {
            echo $q->mysql_error;
        }
    }
    if (isset($ARRAY["ARTICA_META_EVENTS"])) {
        echo __LINE__ . " ** ARTICA_META_EVENTS:" . strlen($ARRAY["ARTICA_META_EVENTS"]) . " bytes\n";
        $qev = new mysql();
        $qev->QUERY_SQL($ARRAY["ARTICA_META_EVENTS"], "artica_events");
        if (!$qev->ok) {
            echo "*********************************\n\${$qev->mysql_error}\n*********************************\n";
        }
    } else {
        echo __LINE__ . " ** ARTICA_META_EVENTS: NONE\n";
    }
    $CPU = $ARRAY["CPU"];
    $load = $ARRAY["load"];
    $pourc_mem = $ARRAY["memory"]["ram"]["percent"];
    $ram_used = $ARRAY["memory"]["ram"]["used"];
    $ram_total = $ARRAY["memory"]["ram"]["total"];
    $ALL_DISKS_STATUS = mysql_escape_string2($ARRAY["ALL_DISKS_STATUS"]);
    echo "ALL_DISKS_STATUS:{$ALL_DISKS_STATUS}\n";
    $sql = "SELECT hostname FROM metahosts WHERE uuid='{$UUID}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $currentDate = date("Y-m-d H:i:s");
    $squid = 0;
    $squidver = null;
    if (isset($ARRAY["SQUID"])) {
        $squid = $ARRAY["SQUID"];
    }
    if (isset($ARRAY["squidver"])) {
        $squidver = $ARRAY["squidver"];
    }
    if (trim($ligne["hostname"]) == null) {
        $q->QUERY_SQL("INSERT IGNORE INTO `metahosts` (uuid,hostname,public_ip,updated,blacklisted,`version`,`CPU_NUMBER`\n\t\t\t\t,`load`,`mem_perc`,`mem_used`,mem_total,disks,PROXY,squidver) \n\t\t\t\tVALUES('{$UUID}','{$hostname}','{$IPADDR}','{$currentDate}',0,'{$version}','{$CPU}'\n\t\t\t\t,'{$load}','{$pourc_mem}','{$ram_used}','{$ram_total}','{$ALL_DISKS_STATUS}','{$squid}','{$squidver}')");
        if (!$q->ok) {
            echo $q->mysql_error;
            return false;
        }
    } else {
        $q->QUERY_SQL("UPDATE `metahosts` SET public_ip='{$IPADDR}', `hostname`='{$hostname}',\n\t\t\t\t`updated`='{$currentDate}',`version`='{$version}',\n\t\t\t\t`CPU_NUMBER`='{$CPU}',\n\t\t\t\t`load`='{$load}',\n\t\t\t\t`mem_perc`='{$pourc_mem}',\n\t\t\t\t`mem_used`='{$ram_used}',\n\t\t\t\tmem_total='{$ram_total}',\n\t\t\t\t`disks`='{$ALL_DISKS_STATUS}',\n\t\t\t\tPROXY='{$squid}',\n\t\t\t\tsquidver='{$squidver}'\n\t\t\t\tWHERE uuid='{$UUID}'");
        if (!$q->ok) {
            if (preg_match("#Unknown column#", $q->mysql_error)) {
                $q->CheckTables();
            }
        }
        if (!$q->ok) {
            echo $q->mysql_error;
            return false;
        }
    }
    return true;
}
Пример #5
0
function ping()
{
    $articameta = new artica_meta();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/var/run/artica-meta-client.run";
    $unix = new unix();
    $sock = new sockets();
    $ArticaMetaKillProcess = intval($sock->GET_INFO("ArticaMetaKillProcess"));
    if ($ArticaMetaKillProcess == 0) {
        $ArticaMetaKillProcess = 60;
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timePid = $unix->PROCCESS_TIME_MIN($pid);
        if ($timePid < $ArticaMetaKillProcess) {
            client_progress("A Meta client process already running pid: {$pid} since {$timePid}Mn", 110);
            $articameta->events("A Meta client process already running pid: {$pid} since {$timePid}Mn", __FUNCTION__, __FILE__, __LINE__);
            die;
        } else {
            $articameta->events("Killing running pid: {$pid} since {$timePid}Mn", __FUNCTION__, __FILE__, __LINE__);
            $unix->KILL_PROCESS($pid);
        }
    }
    if ($GLOBALS["ENABLE"]) {
        $sock->SET_INFO("EnableArticaMetaClient", 1);
    }
    $T1 = time();
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    $ArticaMetaPooling = intval($sock->GET_INFO("ArticaMetaPooling"));
    $MetaClientAutoUpdate = intval($sock->GET_INFO("MetaClientAutoUpdate"));
    if ($ArticaMetaPooling == 0) {
        $ArticaMetaPooling = 15;
    }
    $pidTimeEx = $unix->file_time_min($pidTime);
    if ($GLOBALS["OUTPUT"]) {
        echo "EnableArticaMetaClient = {$EnableArticaMetaClient}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Last ping {$pidTimeEx}Mn Pool:{$ArticaMetaPooling}mn\n";
    }
    if (!$GLOBALS["OUTPUT"]) {
        if ($pidTimeEx < $ArticaMetaPooling) {
            $articameta->events("{$pidTimeEx} < {$ArticaMetaPooling}, stop processing", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    @file_put_contents($pidfile, getmypid());
    $nice = $unix->EXEC_NICE();
    $php = $unix->LOCATE_PHP5_BIN();
    if ($EnableArticaMetaClient == 0) {
        client_progress("{disabled}", 110);
        if (is_file("/etc/cron.hourly/metaclient.sh")) {
            @unlink("/etc/cron.hourly/metaclient.sh");
        }
        if (is_file("/etc/cron.d/artica-meta-c")) {
            @unlink("/etc/cron.d/artica-meta-c");
        }
        return;
    }
    $ionice = $unix->EXEC_NICE();
    $articameta->events("Creating tasks...", __FUNCTION__, __FILE__, __LINE__);
    client_progress("Creating tasks Pooling={$ArticaMetaPooling}Mn...", 10);
    if ($ArticaMetaPooling == 240) {
        $f[] = "MAILTO=\"\"";
        $f[] = "0 4,8,12,16,20 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 120) {
        $f[] = "MAILTO=\"\"";
        $f[] = "0 2,4,6,8,10,12,14,16,18,20,22 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 60) {
        $f[] = "MAILTO=\"\"";
        $f[] = "0 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 30) {
        $f[] = "MAILTO=\"\"";
        $f[] = "30,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 20) {
        $f[] = "MAILTO=\"\"";
        $f[] = "20,40,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 15) {
        $f[] = "MAILTO=\"\"";
        $f[] = "10,15,30,45,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 10) {
        $f[] = "MAILTO=\"\"";
        $f[] = "10,20,30,40,50,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 5) {
        $f[] = "MAILTO=\"\"";
        $f[] = "5,10,15,20,25,30,35,40,45,50,55,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 2) {
        $f[] = "MAILTO=\"\"";
        $f[] = "0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if ($ArticaMetaPooling == 3) {
        $f[] = "MAILTO=\"\"";
        $f[] = "3,6,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,55,57,59 * * * *  root {$ionice}  {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/artica-meta-c", @implode("\n", $f));
        @chmod("/etc/cron.d/artica-meta-c", 0644);
        unset($f);
    }
    if (!is_file("/etc/cron.hourly/metaclient.sh")) {
        $f[] = "#!/bin/sh";
        $f[] = "export LC_ALL=C";
        $f[] = "{$nice} {$php} " . __FILE__ . " --ping >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.hourly/metaclient.sh", @implode("\n", $f));
        @chmod("/etc/cron.hourly/metaclient.sh", 0755);
        shell_exec("/etc/init.d/cron reload");
        unset($f);
    }
    $articaMeta = new artica_meta();
    $articaMeta->events("Ping the Meta server [{$articaMeta->ArticaMetaHostname}]...", __FUNCTION__, __FILE__, __LINE__);
    client_progress("Ping the Meta server [{$articaMeta->ArticaMetaHostname}]...", 20);
    if (!$articaMeta->ping()) {
        if ($GLOBALS["OUTPUT"]) {
            echo "PING FAILED\n";
        }
        $articaMeta->events("Ping Failed {$articaMeta->ping_error}", __FUNCTION__, __FILE__, __LINE__);
        writelogs_meta("Ping Failed {$articaMeta->ping_error}", __FUNCTION__, __FILE__, __LINE__);
        client_progress("Ping the Meta server {failed}...", 110);
        return;
    }
    $ArticaMetaDumpSQLMD5 = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaMetaDumpSQLMD5"));
    $ArticaMetaDumpSQLClientMD5 = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaMetaDumpSQLClientMD5"));
    $articaMeta->events("ArticaMetaDumpSQLMD5       = {$ArticaMetaDumpSQLMD5}", __FUNCTION__, __FILE__, __LINE__);
    $articaMeta->events("ArticaMetaDumpSQLClientMD5 = {$ArticaMetaDumpSQLClientMD5}", __FUNCTION__, __FILE__, __LINE__);
    if ($ArticaMetaDumpSQLMD5 != null) {
        if ($ArticaMetaDumpSQLMD5 != $ArticaMetaDumpSQLClientMD5) {
            if ($articaMeta->retreive_dump_sql($ArticaMetaDumpSQLMD5)) {
                $articaMeta->events("Update ArticaMetaDumpSQLClientMD5 key with {$ArticaMetaDumpSQLMD5}", __FUNCTION__, __FILE__, __LINE__);
                @file_put_contents("/etc/artica-postfix/settings/Daemons/ArticaMetaDumpSQLClientMD5", $ArticaMetaDumpSQLMD5);
                $php = $unix->LOCATE_PHP5_BIN();
                system("{$php} /usr/share/artica-postfix/exec.squid-meta.php");
            }
        }
    }
    $took = $unix->distanceOfTimeInWords($T1, time(), true);
    client_progress("Ping the Meta server {succes} {took} {$took}...", 90);
    events("Ping Success...Took:" . $unix->distanceOfTimeInWords($T1, time(), true), __FUNCTION__, __FILE__, __LINE__);
    shell_exec("{$php} " . __FILE__ . " --logrotate >/dev/null 2>&1 &");
    smtp_to_meta();
    if ($MetaClientAutoUpdate == 1) {
        $articaMeta->events("Check updates from Meta server...", __FUNCTION__, __FILE__, __LINE__);
        client_progress("Check updates from Meta server...", 95);
        artica_updates_scheduled(true);
    }
    client_progress("{success}", 100);
}