function purge_cache($ID) { if (!is_numeric($ID)) { return; } $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [PURGE]: Nginx Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT directory FROM nginx_caches WHERE ID='{$ID}'")); $directory = $ligne["directory"]; if (!is_dir($directory)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [PURGE]: `{$directory}` no such directory\n"; } } $rm = $unix->find_program("rm"); shell_exec("{$rm} -rf \"{$directory}\""); @mkdir($directory, true, 0755); reload(true); caches_status(); }
} } //$GLOBALS["DEBUG_TEMPLATE"]=true; include_once 'ressources/class.squid.inc'; include_once 'ressources/class.status.inc'; include_once 'ressources/class.artica.graphs.inc'; if (isset($_GET["status"])) { echo status(); exit; } if (isset($_GET["RightMenu1"])) { echo RightMenu1(); exit; } if (isset($_GET["caches-status"])) { echo caches_status(); exit; } page(); function page() { $title = "{SQUID_STATS}"; $page = CurrentPageName(); $html = "\n\n<script>\n\t\tLoadAjax('content','{$page}?status=yes')\n</script>\n"; $tpl = new template_users($title, $html, $_SESSION, 0, 0, 0); $html = $tpl->web_page; echo $html; } function status() { $page = CurrentPageName();