示例#1
0
function SendPing()
{
    emergency(true);
    $cmd = LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php >/dev/null 2>&1 &";
    if (is_file("/etc/artica-postfix/artica-meta.tasks")) {
        $meta = new artica_meta();
        $meta->events("artica-meta.tasks exists, execute tasks...", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
        return;
    }
    $http = new httpget();
    $meta = new artica_meta();
    $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
    $ArticaMetaHostname = $meta->ArticaMetaHostname;
    $meta->events("Send Ping to meta console...", __FUNCTION__, __FILE__, __LINE__);
    $metaconsole = $http->send("{$ArticaMetaHostname}/lic.status.notifs.php", "post", array("DATAS" => $datasToSend, "PING" => "yes"));
    if ($metaconsole == "FAILED_CONNECT") {
        $meta->events("Result:\"{$metaconsole}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (preg_match("#<TASKS>(.+?)</TASKS>#is", $metaconsole, $re)) {
        $meta->events("Save tasks to /etc/artica-postfix/artica-meta.tasks", __FUNCTION__, __FILE__, __LINE__);
        @file_put_contents("/etc/artica-postfix/artica-meta.tasks", $re[1]);
        $meta->events("TASKS ->{$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
        return;
    }
    $meta->events("<results>\n{$metaconsole}\n</results>", __FUNCTION__, __FILE__, __LINE__);
}
示例#2
0
function snapshot()
{
    $unix = new unix();
    $password = null;
    $mysqldump = $unix->find_program("mysqldump");
    $gzip = $unix->find_program("gzip");
    $sock = new sockets();
    $rm = $unix->find_program("rm");
    $BaseWorkDir = "/usr/share/artica-postfix/snapshots/" . time();
    $tar = $unix->find_program("tar");
    @mkdir($BaseWorkDir, 0755, true);
    $nice = $unix->EXEC_NICE();
    $q = new mysql();
    $LIST_TABLES_ARTICA_BACKUP = $q->LIST_TABLES_ARTICA_BACKUP();
    if ($q->mysql_password != null) {
        $password = "******" . $unix->shellEscapeChars($q->mysql_password);
    }
    $prefix = trim("{$nice} {$mysqldump} --add-drop-table --single-transaction --force --insert-ignore -S /var/run/mysqld/mysqld.sock -u {$q->mysql_admin}{$password} artica_backup");
    $ARRAY["artica_backup_blacklists"]["ipblocks_db"] = true;
    $ARRAY["artica_backup_blacklists"]["adgroups"] = true;
    $ARRAY["artica_backup_blacklists"]["adusers"] = true;
    $ARRAY["artica_backup_blacklists"]["drupal_queue_orders"] = true;
    $ARRAY["artica_backup_blacklists"]["haarp"] = true;
    $ARRAY["artica_backup_blacklists"]["icons_db"] = true;
    $ARRAY["artica_backup_blacklists"]["setup_center"] = true;
    $ARRAY["artica_backup_blacklists"]["clamavsig"] = true;
    $ARRAY["artica_backup_blacklists"]["kav4proxy_license"] = true;
    $ARRAY["artica_backup_blacklists"]["getent_groups"] = true;
    $ARRAY["artica_backup_blacklists"]["zarafa_orphaned"] = true;
    $c = 0;
    @mkdir("{$BaseWorkDir}/artica_backup", 0755, true);
    while (list($table_name, $val) = each($LIST_TABLES_ARTICA_BACKUP)) {
        $table_name = trim($table_name);
        if (isset($ARRAY["artica_backup_blacklists"][$table_name])) {
            continue;
        }
        if (preg_match("#^activedirectory#", $table_name)) {
            continue;
        }
        if (preg_match("#^amanda#", $table_name)) {
            continue;
        }
        if ($q->COUNT_ROWS($table_name, "artica_backup") == 0) {
            $GLOBALS["TRUNCATES"]["artica_backup"][$table_name] = true;
            continue;
        }
        progress(15, "{backup} {$table_name}");
        echo "{$BaseWorkDir}/artica_backup/{$table_name}.gz\n";
        $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/artica_backup/{$table_name}.gz 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$cmd}\n";
        }
        exec($cmd, $results);
        if ($unix->MYSQL_BIN_PARSE_ERROR($results)) {
            echo "Failed to create snapshot\n " . @implode("\n", $results);
            system_admin_events("Failed to create snapshot " . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__);
            shell_exec("{$rm} -rf {$BaseWorkDir}");
            return;
        }
        $GLOBALS["ARRAY_CONTENT"]["artica_backup/{$table_name}.gz"] = @filesize("{$BaseWorkDir}/artica_backup/{$table_name}.gz");
        $c++;
    }
    $squidbin = $unix->LOCATE_SQUID_BIN();
    if (is_file($squidbin)) {
        if ($unix->is_socket("/var/run/mysqld/squid-db.sock")) {
            $q = new mysql_squid_builder();
            $LIST_TABLES_ARTICA_SQUIDLOGS = $q->LIST_TABLES_ARTICA_SQUIDLOGS();
            if ($q->mysql_password != null) {
                $password = "******" . $unix->shellEscapeChars($q->mysql_password);
            }
            $prefix = trim("{$nice} {$mysqldump} --add-drop-table --single-transaction --force --insert-ignore -S /var/run/mysqld/squid-db.sock -u root squidlogs");
            @mkdir("{$BaseWorkDir}/squidlogs", 0755, true);
            $BLACKLIST["tables_day"] = true;
            $BLACKLIST["quotachecked"] = true;
            $BLACKLIST["cached_total"] = true;
            $BLACKLIST["MySQLStats"] = true;
            $BLACKLIST["phraselists_weigthed"] = true;
            $BLACKLIST["squid_reports"] = true;
            $BLACKLIST["stats_appliance_events"] = true;
            $BLACKLIST["webfilter_catprivslogs"] = true;
            $BLACKLIST["webfilters_backupeddbs"] = true;
            $BLACKLIST["webfilters_bigcatzlogs"] = true;
            $BLACKLIST["FamilyCondensed"] = true;
            $BLACKLIST["catztemp"] = true;
            $BLACKLIST["hotspot_sessions"] = true;
            $BLACKLIST["instant_updates"] = true;
            $BLACKLIST["macscan"] = true;
            $BLACKLIST["members_uid"] = true;
            $BLACKLIST["members_macip"] = true;
            $BLACKLIST["members_mac"] = true;
            $BLACKLIST["webfilters_categories_caches"] = true;
            $BLACKLIST["webfilters_thumbnails"] = true;
            $BLACKLIST["wpad_events"] = true;
            while (list($table_name, $val) = each($LIST_TABLES_ARTICA_SQUIDLOGS)) {
                if (isset($BLACKLIST[$table_name])) {
                    continue;
                }
                if (preg_match("#[0-9]+#", $table_name)) {
                    continue;
                }
                if (preg_match("#[0-9]+#", $table_name)) {
                    continue;
                }
                if (preg_match("#updateev\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^traffic#", $table_name)) {
                    continue;
                }
                if (preg_match("#^www_#", $table_name)) {
                    continue;
                }
                if (preg_match("#^visited_#", $table_name)) {
                    continue;
                }
                if (preg_match("#^youtube_#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UserAgents#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UserAutDB#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UserAuthDays#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UserAuthDaysGrouped#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UserSizeRTT#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UsersAgentsDB#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UsersTMP#", $table_name)) {
                    continue;
                }
                if (preg_match("#^UsersToTal#", $table_name)) {
                    continue;
                }
                if (preg_match("#^allsizes#", $table_name)) {
                    continue;
                }
                if (preg_match("#^alluid#", $table_name)) {
                    continue;
                }
                if (preg_match("#^categorize#", $table_name)) {
                    continue;
                }
                if (preg_match("#^blocked_#", $table_name)) {
                    continue;
                }
                if (preg_match("#^sites\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^users\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^ufdbunlock\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^updateblks_events\$#", $table_name)) {
                    continue;
                }
                if (preg_match("#^main_websites#", $table_name)) {
                    continue;
                }
                if (preg_match("#^notcategorized#", $table_name)) {
                    continue;
                }
                if ($q->COUNT_ROWS($table_name, "squidlogs") == 0) {
                    $GLOBALS["TRUNCATES"]["squidlogs"][$table_name] = true;
                    continue;
                }
                progress(30, "{backup} {$table_name}");
                echo "{$BaseWorkDir}/squidlogs/{$table_name}.gz\n";
                $cmd = "{$prefix} {$table_name} | {$gzip} > {$BaseWorkDir}/squidlogs/{$table_name}.gz 2>&1";
                if ($GLOBALS["VERBOSE"]) {
                    echo "{$cmd}\n";
                }
                exec($cmd, $results);
                if ($unix->MYSQL_BIN_PARSE_ERROR($results)) {
                    echo "Failed to create snapshot\n " . @implode("\n", $results);
                    shell_exec("{$rm} -rf {$BaseWorkDir}");
                    system_admin_events("Failed to create snapshot " . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__);
                    return;
                }
                $GLOBALS["ARRAY_CONTENT"]["squidlogs/{$table_name}.gz"] = @filesize("{$BaseWorkDir}/squidlogs/{$table_name}.gz");
                $c++;
            }
        }
    }
    progress(35, "{backup} OpenDLAP server");
    backup_ldap($BaseWorkDir);
    progress(40, "{backup} Reverse Proxy");
    backup_nginx($BaseWorkDir);
    progress(45, "{backup} PowerDNS");
    backup_mysql_powerdns($BaseWorkDir);
    progress(50, "{backup} Artica settings");
    backup_artica_settings($BaseWorkDir);
    @file_put_contents("{$BaseWorkDir}/TRUNCATE_TABLES", serialize($GLOBALS["TRUNCATES"]));
    $temp = $unix->FILE_TEMP() . ".tar.gz";
    $tempdir = $unix->TEMP_DIR();
    chdir($BaseWorkDir);
    progress(60, "{compressing}");
    system("{$tar} -czf {$temp} *");
    shell_exec("{$rm} -rf {$BaseWorkDir}");
    echo "{$temp}\n";
    $q = new mysql();
    $q->CREATE_DATABASE("artica_snapshots");
    $sql = "CREATE TABLE IF NOT EXISTS `snapshots` (\n\t`ID` int(11) NOT NULL AUTO_INCREMENT,\n\t`zmd5` VARCHAR(90) NOT NULL,\n\t`size` INT UNSIGNED NOT NULL,\n\t`zDate` DATETIME NOT NULL,\n\t`snap` LONGBLOB NOT NULL,\n\t `content` TEXT NOT NULL,\n\t PRIMARY KEY (`ID`),\n\t UNIQUE KEY `zmd5` (`zmd5`),\n\t KEY `zDate` (`zDate`)\n\t) ENGINE=MyISAM";
    $q->QUERY_SQL($sql, 'artica_snapshots');
    progress(70, "{saving}");
    if ($GLOBALS["SEND_META"]) {
        $articameta = new artica_meta();
        $filemeta = $tempdir . "/snapshot.tar.gz";
        if (@copy($temp, $filemeta)) {
            if (!$articameta->SendFile($filemeta, "SNAPSHOT")) {
                $articameta->events("{$temp} unable to upload", __FUNCTION__, __FILE__, __LINE__);
            }
        } else {
            $articameta->events("{$temp} unable to copy {$temp} to {$filemeta}", __FUNCTION__, __FILE__, __LINE__);
        }
        @unlink($filemeta);
    }
    $zmd5 = md5_file($temp);
    $data = mysql_escape_string2(@file_get_contents($temp));
    $size = @filesize($temp);
    $final_array = mysql_escape_string2(serialize($GLOBALS["ARRAY_CONTENT"]));
    $q->QUERY_SQL("INSERT IGNORE INTO `snapshots` (zDate,snap,size,content,zmd5) \n\t\t\tVALUES (NOW(),'{$data}','{$size}','{$final_array}','{$zmd5}')", "artica_snapshots");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
        progress(70, "{failed}");
    }
    @unlink($temp);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/snapshots");
    progress(100, "{success}");
}
function artica_meta_client($force = false)
{
    $unix = new unix();
    $WORKDIR = "/var/lib/ftpunivtlse1fr";
    @mkdir($WORKDIR, 0755, true);
    @chmod($WORKDIR, 0755);
    $tmpdir = $unix->TEMP_DIR();
    $myVersion = intval(trim(@file_get_contents("/etc/artica-postfix/ftpunivtlse1fr.txt")));
    $tmpdir = $unix->TEMP_DIR();
    $meta = new artica_meta();
    $curl = $meta->buildCurl("/meta-updates/webfiltering/ftpunivtlse1fr.txt");
    if (!$curl->GetFile("{$tmpdir}/ftpunivtlse1fr.txt")) {
        artica_update_event(0, "Failed Downloading webfiltering/ftpunivtlse1fr.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
        $meta->events($curl->errors, __FUNCTION__, __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed Downloading webfiltering/ftpunivtlse1fr.txt", @implode("\n", $curl->errors), __FILE__, __LINE__);
        return false;
    }
    $Remote_version = intval(trim(@file_get_contents("{$tmpdir}/ftpunivtlse1fr.txt")));
    @unlink("{$tmpdir}/ftpunivtlse1fr.txt");
    echo "Current............: {$myVersion}\n";
    echo "Available..........: {$Remote_version}\n";
    $datev = date("Y-m-d H:i:s", $myVersion);
    $STATUS = unserialize(@file_get_contents("/etc/artica-postfix/TLSE_LAST_DOWNLOAD"));
    $STATUS["LAST_CHECK"] = time();
    @file_put_contents("/etc/artica-postfix/TLSE_LAST_DOWNLOAD", serialize($STATUS));
    if ($myVersion > $Remote_version) {
        echo "My version {$myVersion} is newest than {$Remote_version}, aborting\n";
        build_progress("{version-up-to-date} {$datev}", 100);
        return;
    }
    if ($myVersion == $Remote_version) {
        build_progress("{version-up-to-date} {$datev}", 100);
        echo "My version {$myVersion} is the same than {$Remote_version}, aborting\n";
        return;
    }
    $curl = $meta->buildCurl("/meta-updates/webfiltering/ftpunivtlse1fr.tgz");
    $curl->Timeout = 120;
    if (!$curl->GetFile("{$tmpdir}/ftpunivtlse1fr.tgz")) {
        artica_update_event(0, "Failed Downloading webfiltering/ftpunivtlse1fr.tgz", @implode("\n", $curl->errors), __FILE__, __LINE__);
        $meta->events($curl->errors, __FUNCTION__, __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed Downloading webfiltering/ftpunivtlse1fr.tgz", @implode("\n", $curl->errors), __FILE__, __LINE__);
        @unlink("{$tmpdir}/ftpunivtlse1fr.tgz");
        return false;
    }
    if (!$unix->TARGZ_TEST_CONTAINER("{$tmpdir}/ftpunivtlse1fr.tgz")) {
        artica_update_event(0, "Failed {$tmpdir}/ftpunivtlse1fr.tgz corrupted package", @implode("\n", $curl->errors), __FILE__, __LINE__);
        meta_admin_mysql(0, "Failed {$tmpdir}/ftpunivtlse1fr.tgz corrupted package", @implode("\n", $curl->errors), __FILE__, __LINE__);
        @unlink("{$tmpdir}/ftpunivtlse1fr.tgz");
        return false;
    }
    $tar = $unix->find_program("tar");
    shell_exec("{$tar} -xf {$tmpdir}/ftpunivtlse1fr.tgz -C {$WORKDIR}/");
    @unlink("{$tmpdir}/ftpunivtlse1fr.tgz");
    artica_update_event(0, "Success update categories statistics v.{$Remote_version}", @implode("\n", $curl->errors), __FILE__, __LINE__);
    meta_admin_mysql(0, "Success update categories statistics v.{$Remote_version}", @implode("\n", $curl->errors), __FILE__, __LINE__);
    @file_put_contents("/etc/artica-postfix/ftpunivtlse1fr.txt", $Remote_version);
    build_progress("Using Artica Meta server {done}", 100);
    CoherenceOffiels();
    CoherenceRepertoiresUfdb();
    BuildDatabaseStatus();
    remove_bad_files();
}
示例#4
0
function ParseEvents()
{
    ParseReboot();
    $unix = new unix();
    $path = "/var/log/artica-postfix/events";
    $f = new filesClasses();
    $hash = $f->DirListTable($path);
    if (!is_array($hash)) {
        return null;
    }
    $users = new usersMenus();
    $sock = new sockets();
    $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled");
    echo date('Y-m-d h:i:s') . " " . count($hash) . " file(s) notifications...\n";
    events(count($hash) . " file(s) notifications...");
    if (count($hash) == 0) {
        return;
    }
    if ($ArticaMetaEnabled == 1) {
        $meta = new artica_meta();
        $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
        $ArticaMetaHostname = $meta->ArticaMetaHostname;
        events("ArticaMetaEnabled: \"{$ArticaMetaEnabled}\" -> ({$ArticaMetaHostname})");
    }
    $mysql = new mysql();
    while (list($num, $file) = each($hash)) {
        $text = null;
        $processname = null;
        $date = null;
        $context = null;
        $subject = null;
        $recipient = null;
        $FULL_PATH = "{$path}/{$file}";
        if ($unix->file_time_min($FULL_PATH) > 480) {
            @unlink($FULL_PATH);
            continue;
        }
        $bigtext = @file_get_contents($FULL_PATH);
        echo date('Y-m-d h:i:s') . " Parsing {$file} " . strlen($bigtext) . " bytes text\n";
        $ini = new Bs_IniHandler();
        if (preg_match("#<text>(.+?)</text>#is", $bigtext, $re)) {
            $text = $re[1];
            $bigtext = str_replace($re[0], '', $bigtext);
            $bigtext = str_replace("'", "`", $bigtext);
        }
        if (preg_match("#<attachedfiles>(.+?)</attachedfiles>#is", $bigtext, $re)) {
            $bigtext = str_replace($re[0], '', $bigtext);
            $files_text = addslashes($re[1]);
        }
        $ini->loadString($bigtext);
        $processname = $ini->_params["LOG"]["processname"];
        $date = $ini->_params["LOG"]["date"];
        $context = $ini->_params["LOG"]["context"];
        if ($context == "YTowOnt9") {
            $context = "system";
        }
        $subject = $ini->_params["LOG"]["subject"];
        $recipient = $ini->_params["LOG"]["recipient"];
        if (strlen($text) < 2) {
            $text = $ini->_params["LOG"]["text"];
        }
        $arrayToSend["context"] = $context;
        $arrayToSend["subject"] = $subject;
        $arrayToSend["text"] = $text;
        $arrayToSend["date"] = $date;
        echo date('Y-m-d h:i:s') . " Parsing subject {$subject} " . strlen($text) . " bytes text\n";
        writelogs("New notification: {$subject} (" . strlen($text) . " bytes) {$date}", __FUNCTION__, __FILE__, __LINE__);
        $event_id = time();
        //$text=addslashes($text);
        $text = str_replace("'", "`", $text);
        $subject = str_replace("'", "`", $subject);
        $text = addslashes($text);
        $subject = addslashes($subject);
        if ($subject == null) {
            if (strlen($text) > 5) {
                if (strpos($text, "\n") == 0) {
                    $subject = $text;
                } else {
                    $subject = substr($text, 0, 75) . "...";
                }
            }
        }
        if (strlen($subject) < 5) {
            writelogs("Warning New notification: Subject seems to be empty ! \"{$text}\" removing {$path}/{$file}", __FUNCTION__, __FILE__, __LINE__);
            @unlink("{$path}/{$file}");
            continue;
        }
        if (strpos($users->hostname, ".") > 0) {
            $ty = explode($users->hostname, ".");
            $users->hostname = $ty[0];
        }
        if (strlen($text) < 5) {
            $text = "No content body as been added for this notification";
        }
        $sql = "INSERT IGNORE INTO events (zDate,hostname,process,text,context,content,attached_files,recipient,event_id) VALUES(\n        \t'{$date}',\n        \t'{$users->hostname}',\n        \t'{$processname}',\n        \t'{$subject}',\n        \t'{$context}','{$text}','{$files_text}','{$recipient}','{$event_id}')";
        if (!$mysql->UseMysql) {
            $sql = "INSERT IGNORE INTO events (id,zDate,hostname,\n        \tprocess,text,context,content,attached_files,recipient,event_id) VALUES(\n        \t'{$event_id}','{$date}',\n        \t'{$users->hostname}',\n        \t'{$processname}',\n        \t'{$subject}',\n        \t'{$context}','{$text}','{$files_text}','{$recipient}','{$event_id}')";
        }
        events(date('Y-m-d h:i:s') . " run mysql query -> {$subject}");
        if (!$mysql->QUERY_SQL($sql, 'artica_events')) {
            events("Mysql error keep {$path}/{$file};");
            events("Fatal: {$mysql->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
            if (preg_match("#Access denied for user.+?using password:#", $mysql->mysql_error)) {
                events("Access denied for user password: {$mysql->mysql_server}@{$mysql->mysql_admin}:{$mysql->mysql_password} detected");
                if ($mysql->mysql_server == "127.0.0.1" or $mysql->mysql_server == "localhost") {
                    $ldap = new clladp();
                    $unix = new unix();
                    $ldap->ldap_password = $unix->shellEscapeChars($ldap->ldap_password);
                    writelogs("Try to change the mysql password: /usr/share/artica-postfix/bin/artica-install --change-mysqlroot --inline root \"secret\"", __FUNCTION__, __FILE__, __LINE__);
                    exec("/usr/share/artica-postfix/bin/artica-install --change-mysqlroot --inline root \"secret\" 2>&1", $chroot);
                    writelogs("Chaning password="******"\n", $chroot), __FUNCTION__, __FILE__, __LINE__);
                    die;
                }
            }
            if (preg_match("#Unknown column#", $mysql->mysql_error)) {
                events("->BuildTables()");
                $mysql->BuildTables();
            }
            if (preg_match("#Unknown database#", $mysql->mysql_error)) {
                events("->BuildTables()");
                $mysql->BuildTables();
            }
            if (preg_match("#connect to local MySQL server through socket#", $mysql->mysql_error)) {
                shell_exec("/etc/init.d/artica-postfix start mysql &");
            }
            writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
            break;
        }
        unlink($path . '/' . $file);
        if ($ArticaMetaEnabled == 1) {
            $pidfile = "/etc/artica-postfix/pids/exec.artica.meta.php.SendStatus.pid";
            $sock = new sockets();
            $ArticaMetaPoolTimeMin = $sock->GET_INFO("ArticaMetaPoolTimeMin");
            if (!is_numeric($ArticaMetaPoolTimeMin)) {
                $ArticaMetaPoolTimeMin = 15;
            }
            if ($ArticaMetaPoolTimeMin < 2) {
                $ArticaMetaPoolTimeMin = 15;
            }
            $minutes = file_time_min($pidfile);
            if ($minutes < round($ArticaMetaPoolTimeMin / 2.5)) {
                $meta->events(basename($pidfile) . ":{$minutes}<" . round($ArticaMetaPoolTimeMin / 2.5) . "Mn, aborting", __FUNCTION__, __FILE__, __LINE__);
                return;
            }
            $http = new httpget();
            $meta->events("Send notification \"{$arrayToSend["subject"]}\" to Meta Server", __FUNCTION__, __FILE__, __LINE__);
            $metaconsole = $http->send("{$ArticaMetaHostname}/lic.status.notifs.php", "post", array("DATAS" => $datasToSend, "NOTIF" => base64_encode(serialize($arrayToSend))));
            events("META CONSOLE: {$metaconsole} aborting notifications");
            if ($metaconsole == "FAILED_CONNECT") {
                $meta->events("Result:\"{$metaconsole}\"", __FUNCTION__, __FILE__, __LINE__);
                return;
            }
            if (!is_file("/etc/artica-postfix/artica-meta.tasks")) {
                if (preg_match("#<TASKS>(.+?)</TASKS>#is", $metaconsole, $re)) {
                    $meta->events("Save tasks to /etc/artica-postfix/artica-meta.tasks", __FUNCTION__, __FILE__, __LINE__);
                    @file_put_contents("/etc/artica-postfix/artica-meta.tasks", $re[1]);
                    $cmd = LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php >/dev/null 2>&1 &";
                    $meta->events("TASKS ->{$cmd}", __FUNCTION__, __FILE__, __LINE__);
                    shell_exec($cmd);
                }
            }
        }
        $text = addslashes($text);
        $context = addslashes($context);
        $subject = addslashes($subject);
    }
    if (count($hash) > 0) {
        events(count($hash) . " events queue parsed...");
    }
    if ($ArticaMetaEnabled == 1) {
        if (is_file("/etc/artica-postfix/artica-meta.tasks")) {
            $NICE = EXEC_NICE();
            shell_exec($NICE . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php &");
        }
    }
}