/** * Get data from the last process run * * @param int $type The last processes class (type) defaults to 1 * @return string Data from the last process, or an empty string if not available * */ function process_get_last_data($type = 1) { global $db; $sql = "SELECT process_id\r\n\t\tFROM `process`\r\n\t\tWHERE type = '{$type}'\r\n\t\tORDER BY `process_id` DESC\r\n\t\tLIMIT 1"; $rs = $db->GetRow($sql); if (!empty($rs)) { return process_get_data($rs['process_id']); } return false; }
if (isset($_GET['p'])) { $p = intval($_GET['p']); if (isset($_GET['kill'])) { kill_process($p); } if (isset($_GET['force_kill'])) { end_process($p); } print "<h1>" . T_("Process") . " {$p}</h1>"; if (is_process_killed($p)) { print "<h3>" . T_("Kill signal sent: Please wait...") . "</h3>"; print "<p><a href='?force_kill'>" . T_("Mark the proces as killed (i.e. when the server is rebooted)") . "</a></p>"; } else { print "<p><a href='?kill=kill'>" . T_("Kill the running process") . "</a> (" . T_("may take up to a few minutes to take effect") . ")</p>"; } $d = process_get_data($p); if ($d !== false) { xhtml_table($d, array('process_log_id', 'datetime', 'data'), array(T_("Log id"), T_("Date"), T_("Log entry"))); } } else { global $db; $sql = "SELECT process_id\n\t\tFROM process\n\t\tWHERE stop IS NULL\n\t\tAND type = 2"; $rs = $db->GetAll($sql); if (!empty($rs)) { foreach ($rs as $r) { print "<p><a href='?p={$r['process_id']}'>" . T_("Process") . " {$r['process_id']} " . T_("running...") . "</a></p>"; } } else { print "<h2>" . T_("No process running") . "</h2>"; } print "<h2>" . T_("Outcome of last process run (if any)") . "</h2>";