function build() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); $sock = new sockets(); $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { die; } $php = $unix->LOCATE_PHP5_BIN(); @file_put_contents($pidfile, getmypid()); progress("{get_system_informations}", 30); support_step1(); progress("{APP_UFDBGUARD}", 40); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($EnableUfdbGuard == 1) { $ufdbguardd = $unix->find_program("ufdbguardd"); if (is_file($ufdbguardd)) { shell_exec("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force --verbose >/usr/share/artica-postfix/ressources/support/build-ufdbguard.log 2>&1"); } } progress("{get_all_logs}", 50); support_step2(); progress("{get_all_logs}", 70); export_tables(); progress("{compressing_package}", 90); support_step3(); progress("{success}", 100); }
<?php include_once '_db-config.php'; $filename = 'tempSQL.sql'; if ($localhost) { export_tables($servername_ops, $username_ops, $password_ops, $dbname_ops, $filename); } else { echo "Not on localhost !"; } /* backup the db OR just a table */ function export_tables($host, $user, $pass, $name, $SQLfilename) { $tables = '*'; $link = mysql_connect($host, $user, $pass); mysql_select_db($name, $link); //get all of the tables if ($tables == '*') { $tables = array(); $result = mysql_query('SHOW TABLES'); while ($row = mysql_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',', $tables); } //cycle through foreach ($tables as $table) { $result = mysql_query('SELECT * FROM ' . $table); $num_fields = mysql_num_fields($result); $return .= 'DROP TABLE ' . $table . ';'; $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE ' . $table));
include_once 'ressources/class.squid.remote-stats-appliance.inc'; //ini_set('display_errors', 1); ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL); if (isset($_POST["STATS_LINE"])) { STATS_LINE(); exit; } if (isset($_POST["INSCRIPTION"])) { INSCRIPTION(); exit; } if (isset($_POST["CHANGE_CONFIG"])) { CHANGE_CONFIG(); exit; } if (isset($_POST["SQUID_TABLES_INDEX"])) { export_tables(); exit; } if (isset($_POST["squid_nodes_settings"])) { squid_nodes_settings(); exit; } if (isset($_GET["webtests"])) { webtests(); exit; } function STATS_LINE() { $sock = new sockets(); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) {
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(); export_tables(); 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); }