function install($filename)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
    $unix = new unix();
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
    $LINUX_VERS = $unix->LINUX_VERS();
    $LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
    $APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
    $DebianVer = "debian{$LINUX_VERS[0]}";
    $TMP_DIR = $unix->TEMP_DIR();
    $ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
    $PATCH_VER = null;
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
    echo "Package {$tarballs_file}\n";
    $size = filesize($tarballs_file);
    echo "Size....................: " . FormatBytes($size / 1024) . "\n";
    build_progress("Analyze...", 10);
    echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
    echo "Package.................: {$filename}\n";
    echo "Temp dir................: {$TMP_DIR}\n";
    if (!is_file($tarballs_file)) {
        echo "{$tarballs_file} no such file...\n";
        build_progress("No such file...", 110);
        return;
    }
    echo "Uncompressing {$tarballs_file}...\n";
    build_progress("{extracting} {$filename}...", 20);
    $chown = $unix->find_program("chown");
    $chmod = $unix->find_program("chmod");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squid = $unix->LOCATE_SQUID_BIN();
    build_progress("{extracting} {$filename}...", 50);
    system("{$tar} xf {$tarballs_file} -C /");
    echo "Removing {$tarballs_file}...\n";
    @unlink($tarballs_file);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
    @unlink(dirname(__FILE__) . "/ressources/logs/squid.compilation.params");
    build_progress("{restarting} Squid-cache...", 60);
    system("/etc/init.d/squid restart --force");
    build_progress("{reconfiguring} Squid-cache...", 65);
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    build_progress("{reconfiguring} {APP_UFDBGUARD}...", 70);
    system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
    build_progress("{restarting} {APP_C_ICAP}...", 80);
    system("/etc/init.d/c-icap restart");
    build_progress("Refresh local versions...", 90);
    system('/usr/share/artica-postfix/bin/process1 --force --verbose --' . time());
    $squid_version = x_squid_version();
    build_progress("{success} v.{$squid_version}...", 100);
    echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
}
function install()
{
    $unix = new unix();
    $DISTRICODE = $unix->LINUX_CODE_NAME();
    $arch = $unix->LINUX_ARCHITECTURE();
    $VERS = $unix->LINUX_VERS();
    $dpkg = $unix->find_program("dpkg");
    echo "DISTRICODE:{$DISTRICODE} \n";
    if (!python_verify_modules("MySQLdb")) {
        $unix->DEBIAN_INSTALL_PACKAGE("python-mysqldb");
    }
    if (!python_verify_modules("ldap")) {
        echo "Installing python-ldap\n";
        if ($DISTRICODE == "DEBIAN") {
            if ($arch == 64) {
                if ($VERS[0] == 6) {
                    if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb")) {
                        shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb");
                    }
                }
                if ($VERS[0] == 7) {
                    if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb")) {
                        shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb");
                    }
                }
            }
        }
    }
    if (!python_verify_modules("ldap")) {
        $unix->DEBIAN_INSTALL_PACKAGE("python-ldap");
    }
    if (!python_verify_modules("ldap")) {
        echo "Warning, ldap/python-ldap not installed...\n";
        return;
    }
    if (!python_verify_modules("MySQLdb")) {
        echo "Warning, MySQLdb/python-mysqldb not installed...\n";
        return;
    }
    echo "MySQLdb / python-mysqldb OK\n";
    echo "LDAP / python-ldap OK\n";
    $tmpdir = $unix->TEMP_DIR() . "/iredmail";
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    if (!is_file("/usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz")) {
        return;
    }
    @mkdir($tmpdir, 0755, true);
    shell_exec("{$tar} xf /usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz -C /");
    if (!is_file("/opt/iRedAPD/iredapd.py")) {
        return;
    }
    @chmod("/opt/iRedAPD/iredapd.py", 0755);
}
function install($filename)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/artica.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/artica.install.progress.txt";
    $unix = new unix();
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
    $LINUX_VERS = $unix->LINUX_VERS();
    $LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
    $APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
    $DebianVer = "debian{$LINUX_VERS[0]}";
    $TMP_DIR = $unix->TEMP_DIR();
    $ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
    $PATCH_VER = null;
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
    echo "Package {$tarballs_file}\n";
    $size = filesize($tarballs_file);
    ArticaMeta_release($tarballs_file);
    if (preg_match('#([0-9\\.]+)_([0-9\\.]+)-([0-9]+).tgz$#i', $filename, $r)) {
        $CUR_BRANCH = @file_get_contents("/usr/share/artica-postfix/MAIN_RELEASE");
        $CUR_BRANCH = trim($CUR_BRANCH);
        echo "Patch....................: {$r[3]}\n";
        echo "From.....................: {$r[1]}\n";
        echo "To.......................: {$r[2]}\n";
        echo "Current Branch..........: {$CUR_BRANCH}\n";
        if ($CUR_BRANCH != $r[1]) {
            echo "{$CUR_BRANCH} != {$r[1]}\n";
            build_progress("{not_for_current_branch} {requested} {$r[1]}", 110);
            return;
        }
        $PATCH_VER = $r[2] . " :";
        $ASPATCH = true;
    }
    echo "Size....................: " . FormatBytes($size / 1024) . "\n";
    echo "Current version.........: {$ORGV}\n";
    build_progress("{analyze}...", 10);
    echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
    echo "Package.................: {$filename}\n";
    echo "Temp dir................: {$TMP_DIR}\n";
    echo "Apache User.............: {$APACHEUSER}\n";
    if (!is_file($tarballs_file)) {
        echo "{$tarballs_file} no such file...\n";
        build_progress("No such file...", 110);
        return;
    }
    echo "Uncompressing {$tarballs_file}...\n";
    build_progress("{extracting} {$filename}...", 20);
    $chown = $unix->find_program("chown");
    $chmod = $unix->find_program("chmod");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squid = $unix->LOCATE_SQUID_BIN();
    build_progress("{extracting} {$filename}...", 50);
    system("{$tar} xpf {$tarballs_file} -C /usr/share/");
    echo "Removing {$tarballs_file}...\n";
    @unlink($tarballs_file);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
    build_progress("{apply_permissions}...", 55);
    echo "{$APACHEUSER} -> /usr/share/artica-postfix\n";
    shell_exec("{$chown} -R {$APACHEUSER} /usr/share/artica-postfix");
    echo "0755 -> /usr/share/artica-postfix\n";
    shell_exec("{$chmod} -R 0755 /usr/share/artica-postfix");
    $ORGD = @file_get_contents("/usr/share/artica-postfix/VERSION");
    echo "Old version.............: {$ORGV}\n";
    if ($ASPATCH) {
        $patched = " (patched)";
    }
    echo "Current version.........: {$ORGD}{$patched}\n";
    sleep(2);
    if ($ORGV == $ORGD) {
        build_progress("{operation_failed} Same version {$PATCH_VER}{$filename}...", 110);
        return;
    }
    build_progress("{restarting} Artica...", 60);
    $unix->THREAD_COMMAND_SET("{$php} /usr/share/artica-postfix/exec.web-community-filter.php --register");
    build_progress("{restarting} Artica...", 65);
    build_progress("{building_init_scripts}...", 70);
    system("{$php} /usr/share/artica-postfix/exec.initslapd.php");
    build_progress("{updating_network}...", 75);
    system("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php");
    system("{$php} /usr/share/artica-postfix/exec.monit.php --build");
    echo "Starting......: " . date("H:i:s") . " Purge and clean....\n";
    build_progress("{restarting} Artica...", 80);
    if (is_file("/etc/init.d/nginx")) {
        shell_exec("{$nohup} /etc/init.d/nginx reload >/dev/null 2>&1 &");
    }
    build_progress("{restarting} Artica...", 81);
    shell_exec("{$nohup} /etc/init.d/auth-tail restart");
    build_progress("{restarting} Artica...", 82);
    shell_exec("{$nohup} /etc/init.d/artica-framework");
    build_progress("{restarting} Artica...", 83);
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 --force --verbose " . time() . "");
    build_progress("{restarting} Artica...", 84);
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/artica-make --empty-cache >/dev/null 2>&1 &");
    build_progress("{restarting} Artica...", 85);
    shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    build_progress("{restarting} Artica...", 86);
    shell_exec("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
    build_progress("{restarting} Artica...", 87);
    shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.squid.php --build-schedules >/dev/null 2>&1 &");
    build_progress("{restarting} Artica...", 88);
    shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.schedules.php --defaults >/dev/null 2>&1 &");
    build_progress("{restarting} Artica...", 90);
    build_progress("{restarting} Artica...", 100);
    echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
}
Exemple #4
0
function wsgate_debian()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "Load unix class...\n";
    }
    $unix = new unix();
    if ($GLOBALS["VERBOSE"]) {
        echo "Load unix class done..\n";
    }
    if (!is_dir("/etc/apt/sources.list.d")) {
        if ($GLOBALS["VERBOSE"]) {
            echo "/etc/apt/sources.list.d, no such directory\n";
        }
        return;
    }
    if (is_file("/etc/apt/sources.list.d/freerdp.list")) {
        @unlink("/etc/apt/sources.list.d/freerdp.list");
    }
    if (is_file("/etc/apt/sources.list.d/freerdp1.list")) {
        if ($GLOBALS["VERBOSE"]) {
            echo "/etc/apt/sources.list.d/freerdp1.list already set\n";
        }
        return;
    }
    $sourcelist = null;
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUXVER = $unix->LINUX_VERS();
    if ($GLOBALS["VERBOSE"]) {
        echo "{$LINUX_CODE_NAME} {$LINUXVER[0]}.{$LINUXVER[1]}\n";
    }
    if ($LINUX_CODE_NAME == "DEBIAN") {
        if ($LINUXVER[0] > 5) {
            $sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/Debian_6.0 ./";
        }
    }
    if ($LINUX_CODE_NAME == "UBUNTU") {
        if ($LINUXVER[0] > 9) {
            if ($LINUXVER[1] > 9) {
                $sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_10.10 ./";
            }
        }
        if ($LINUXVER[0] > 10) {
            if ($LINUXVER[1] > 9) {
                $sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_11.10 ./";
            }
        }
        if ($LINUXVER[0] > 11) {
            if ($LINUXVER[1] > 3) {
                $sourcelist = "deb http://download.opensuse.org/repositories/home:/felfert/xUbuntu_12.04 ./";
            }
        }
    }
    if ($sourcelist == null) {
        if ($GLOBALS["VERBOSE"]) {
            echo "sourcelist is null\n";
        }
        return;
    }
    $wget = $unix->find_program("wget");
    $aptkey = $unix->find_program("apt-key");
    $aptget = $unix->find_program("apt-get");
    $cmd = "{$wget} -O - http://download.opensuse.org/repositories/home:/felfert/Debian_6.0/Release.key | {$aptkey} add -";
    shell_exec($cmd);
    @file_put_contents("/etc/apt/sources.list.d/freerdp1.list", $sourcelist);
    $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y update 2>&1";
    exec($cmd, $results);
    system_admin_events($cmd . "\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "system-update");
    shell_exec($cmd);
    $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y install wsgate 2>&1";
    exec($cmd, $results);
    system_admin_events($cmd . "\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "system-update");
    shell_exec($cmd);
}
function CleanUbuntu()
{
    $unix = new unix();
    if (is_file("/etc/default/whoopsie")) {
        echo "Ubuntu: [INFO] Disabling whoopsie\n";
        @file_put_contents("/etc/default/whoopsie", "[General]\nreport_crashes=false\n");
        shell_exec("/usr/bin/killall whoopsie");
        shell_exec("/etc/init.d/whoopsie stop");
        if (is_file('/usr/sbin/update-rc.d')) {
            shell_exec("/usr/sbin/update-rc.d -f whoopsie remove >/dev/null 2>&1");
        }
    }
    if (is_file("/usr/sbin/console-kit-daemon")) {
        echo "Ubuntu: [INFO] Disabling console-kit-daemon\n";
        shell_exec("/bin/mv /usr/sbin/console-kit-daemon /usr/sbin/console-kit-daemon.bkup");
        shell_exec("/bin/cp /bin/true /usr/sbin/console-kit-daemon");
    }
    if (is_file("/usr/sbin/bluetoothd")) {
        echo "Ubuntu: [INFO] Disabling bluetoothd\n";
        shell_exec("/usr/bin/killall bluetoothd");
        shell_exec("/etc/init.d/bluetooth stop");
        if (is_file('/usr/sbin/update-rc.d')) {
            shell_exec("/usr/sbin/update-rc.d -f bluetooth remove >/dev/null 2>&1");
        }
    }
    if (is_file("/etc/default/avahi-daemon")) {
        echo "Ubuntu: [INFO] Disabling avahi dameon\n";
        if ($unix->LINUX_CODE_NAME() == "UBUNTU") {
            @file_put_contents("/etc/default/avahi-daemon", "AVAHI_DAEMON_START = 0\nAVAHI_DAEMON_DETECT_LOCAL=1\n");
        }
        if (is_file("/etc/init.d/avahi-daemon")) {
            shell_exec("/etc/init.d/avahi-daemon stop");
            if (is_file('/usr/sbin/update-rc.d')) {
                shell_exec("/usr/sbin/update-rc.d -f avahi-daemon remove >/dev/null 2>&1");
                shell_exec("kill -9 `pidof avahi-daemon` >/dev/null 2>&1");
            }
        }
    }
}
Exemple #6
0
function mylinux()
{
    $unix = new unix();
    $ARRAY["LINUX_CODE_NAME"] = trim($unix->LINUX_CODE_NAME());
    $ARRAY["LINUX_DISTRIBUTION"] = trim($unix->LINUX_DISTRIBUTION());
    $ARRAY["LINUX_VERS"] = trim($unix->LINUX_VERS());
    $ARRAY["LINUX_ARCHITECTURE"] = trim($unix->LINUX_ARCHITECTURE());
    echo "<articadatascgi>" . base64_encode(serialize($ARRAY)) . "</articadatascgi>";
}
Exemple #7
0
function install($filename)
{
    $AS_POSTFIX = false;
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/{$filename}.progress";
    $GLOBALS["DOWNLOAD_PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/{$filename}.download.progress";
    echo "Starting {$filename}\n";
    $unix = new unix();
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
    $LINUX_VERS = $unix->LINUX_VERS();
    $LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
    $DebianVer = "debian{$LINUX_VERS[0]}";
    $TMP_DIR = $unix->TEMP_DIR();
    $UPLOADED_DIR = dirname(__FILE__) . "/ressources/conf/upload";
    $UPLOADED_FILE = "{$UPLOADED_DIR}/{$filename}";
    $t = time();
    build_progress("Analyze...{$filename}", 10);
    echo "Operating system........: {$DebianVer}\n";
    if (!is_file($UPLOADED_FILE)) {
        echo "{$UPLOADED_FILE} no such file\n";
        $tarballs_file = "/usr/share/artica-postfix/ressources/logs/web/tarballs.cache";
        $Content = @file_get_contents($tarballs_file);
        $strlen = strlen($Content);
        if (preg_match("#<PACKAGES>(.*?)</PACKAGES>#", $Content, $re)) {
            $MAIN = unserialize(base64_decode($re[1]));
        }
        $ligne = $MAIN[$filename];
        $ARCH = $ligne["ARCH"];
        if (preg_match("#([0-9]+)#", $ARCH, $re)) {
            $ARCHBIN = $re[1];
        }
        $SIZE = $ligne["SIZE"];
        $VERSION = $ligne["VERSION"];
        $distri = $ligne["distri"];
        $uri = $ligne["uri"];
        $TMP_FILE = "{$TMP_DIR}/{$filename}";
    }
    if (is_file($UPLOADED_FILE)) {
        echo "Uploaded {$UPLOADED_FILE}\n";
        $EXTRACT = parsefilename($filename);
        if (count($EXTRACT) < 2) {
            echo "{$filename} did not match defined pattern...\n";
            build_progress("{failed}...{$filename} Not supported", 110);
            @unlink($UPLOADED_FILE);
            sleep(5);
            return;
        }
        $ARCHBIN = $EXTRACT["ARCHBIN"];
        $VERSION = $EXTRACT["VERSION"];
        $distri = $EXTRACT["DISTRI"];
        //$DebianVer=$re[3];
        $TMP_FILE = $UPLOADED_FILE;
        $SIZE = @filesize($TMP_FILE);
    }
    echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
    echo "Package.................: {$filename}\n";
    echo "Architecture............: x{$ARCHBIN}\n";
    echo "Version.................: {$VERSION}\n";
    echo "Operating system........: {$distri}/{$DebianVer}\n";
    echo "Temp dir................: {$TMP_DIR}\n";
    echo "Size....................: {$SIZE} bytes\n";
    $comp = true;
    if ($LINUX_ARCHITECTURE != $ARCHBIN) {
        $comp = false;
        $log[] = "{$LINUX_ARCHITECTURE} !== {$ARCHBIN}";
    }
    if ($LINUX_CODE_NAME != "DEBIAN") {
        $log[] = "{$LINUX_CODE_NAME} !== DEBIAN";
        $comp = false;
    }
    if ($DebianVer != $distri) {
        $comp = false;
        $log[] = "{$DebianVer} !== {$distri}";
        $comp = false;
    }
    if (!$comp) {
        echo @implode("\n", $log);
        build_progress("{not_compatible}...", 110);
        if (is_file($TMP_FILE)) {
            @unlink($TMP_FILE);
        }
        return;
    }
    if (!is_file($UPLOADED_FILE)) {
        echo "Downloading {$filename}...\n";
        build_progress("{downloading} {$filename}...", 20);
        $curl = new ccurl($uri);
        $curl->Timeout = 2400;
        $curl->WriteProgress = true;
        $curl->ProgressFunction = "download_progress";
        if (!$curl->GetFile($TMP_FILE)) {
            build_progress("{downloading} {$filename} {failed}...", 110);
            return;
        }
        if (@filesize($TMP_FILE) != $SIZE) {
            build_progress("{corrupted} {$filename} {failed}...", 110);
            if (is_file($TMP_FILE)) {
                @unlink($TMP_FILE);
            }
            return;
        }
    }
    @unlink("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squid = $unix->LOCATE_SQUID_BIN();
    build_progress("{extracting} {$filename}...", 50);
    if (preg_match("#^hotspot#", $filename)) {
        $AS_HOSTPOT = true;
    }
    if (preg_match("#^influxdb-#", $filename)) {
        $AS_INFLUXDB = true;
        build_progress("{stopping_service} BigData...", 52);
        echo "Stopping BigData engine\n";
        sleep(2);
        system("/etc/init.d/influx-db stop");
    }
    if (preg_match("#^milter-regex-#", $filename)) {
        $AS_INFLUXDB = true;
        build_progress("{stopping_service} Milter-regex...", 52);
        sleep(2);
        system("/etc/init.d/milter-regex stop");
    }
    if (preg_match("#^postfixp#", $filename)) {
        $AS_POSTFIX = TRUE;
        build_progress("{stopping_service} postfix...", 52);
        sleep(2);
        system("/etc/init.d/postfix stop");
        shell_exec("{$rm} -rf /var/spool/postfix/var/run");
    }
    if (preg_match("#^squid32#", $filename)) {
        echo "Removing /lib/squid3\n";
        shell_exec("{$rm} -rf /lib/squid3");
        echo "Removing /usr/sbin/squid\n";
        shell_exec("{$rm} -f /usr/sbin/squid");
    }
    build_progress("{extracting}:...", 53);
    sleep(1);
    $ERROR = false;
    exec("{$tar} xvf {$TMP_FILE} -C / 2>&1", $EXT);
    while (list($index, $ligne) = each($EXT)) {
        echo "{$ligne}\n";
        if (preg_match("#(Cannot|recoverable|Error|exiting)#", $ligne)) {
            $ERROR = true;
        }
    }
    if ($ERROR) {
        build_progress("{extraction_failed}...", 110);
        sleep(4);
        if (is_file($TMP_FILE)) {
            @unlink($TMP_FILE);
        }
        return;
    }
    if (is_file($TMP_FILE)) {
        @unlink($TMP_FILE);
    }
    build_progress("{restart_services}: Artica Status...", 53);
    system("/etc/init.d/artica-status reload --force");
    if (preg_match("#^squid32#", $filename)) {
        @unlink(dirname(__FILE__) . "/ressources/logs/squid.compilation.params");
        build_progress("{restart_services}: Squid-Cache...", 54);
        system("/etc/init.d/squid restart --force");
        build_progress("{restart_services}: exec.squid.php...", 54);
        system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
        build_progress("{restart_services}: exec.squidguard.php...", 54);
        system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
        build_progress("{reconfiguring} {APP_UFDBGUARD}...", 54);
        system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
        build_progress("{restarting} {APP_UFDBGUARD}...", 54);
        system("/etc/init.d/ufdb restart");
        build_progress("{restart_services}: squid restart --force...", 54);
        system("/etc/init.d/squid restart --force");
    }
    if (preg_match("#^pdnsc#", $filename)) {
        $sock = new sockets();
        $sock->SET_INFO("EnablePDNS", 1);
        $sock->SET_INFO("EnableDNSMASQ", 0);
        build_progress("{restart_services}: PowerDNS...", 54);
        shell_exec("/etc/init.d/dnsmasq stop");
        shell_exec("/etc/init.d/pdns restart");
        shell_exec("/etc/init.d/pdns-recursor restart");
    }
    if (preg_match("#^nginx#", $filename)) {
        build_progress("{restart_services}: NGINX...", 54);
        system("/etc/init.d/nginx restart --force");
    }
    if (preg_match("#^ntopng#", $filename)) {
        build_progress("{restart_services}: NTOPNG...", 54);
        system("{$php} /usr/share/artica-postfix/exec.initslapd.php --ntopng --force");
        system("/etc/init.d/ntopng restart --force");
    }
    if (preg_match("#^influxdb-#", $filename)) {
        $AS_INFLUXDB = true;
        build_progress("{starting_service} BigData...", 54);
        echo "Starting BigData engine\n";
        sleep(2);
        system("/etc/init.d/influx-db start");
    }
    if (preg_match("#^milter-regex-#", $filename)) {
        $AS_INFLUXDB = true;
        build_progress("{starting_service} Milter-regex...", 54);
        shell_exec("{$php} /usr/share/artica-postfix/exec.initslapd.php --milter-regex >/dev/null 2>&1 &");
        sleep(2);
        system("/etc/init.d/milter-regex start");
    }
    if ($AS_POSTFIX) {
        build_progress("{starting_service}...", 54);
        system("/etc/init.d/milter-regex restart");
        system("/etc/init.d/milter-greylist restart");
        system("/etc/init.d/postfix restart");
    }
    if ($AS_HOSTPOT) {
        shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.initslapd.php --wifidog >/dev/null 2>&1 &");
    }
    build_progress("Learning the system...", 55);
    system("/usr/share/artica-postfix/bin/process1 --force --verbose -6464646464");
    build_progress("{restart_services}: Auth TAIL...", 55);
    system("/etc/init.d/auth-tail restart");
    build_progress("{restart_services}: Building collection...", 60);
    system("/usr/share/artica-postfix/bin/process1 --force --verbose");
    build_progress("{restart_services}: MONIT...", 60);
    system("/etc/init.d/monit restart");
    build_progress("{restart_services}: Artica Status...", 60);
    system("/etc/init.d/artica-status restart --force");
    if (is_file($squid)) {
        build_progress("{restart_services}: {schedules}...", 70);
        shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.squid.php --build-schedules >/dev/null 2>&1 &");
    }
    build_progress("{restart_services}: init scripts...", 80);
    system("{$php} /usr/share/artica-postfix/exec.initslapd.php --force");
    build_progress("{success}...", 100);
}