'.__('Database Maintenance').' >'.__('Database purge')."";
echo "
";
echo "
";
echo '
'.__('Get data from agent').'
';
// All data (now)
$purge_all = date ("Y-m-d H:i:s", time ());
require("godmode/db/times_incl.php");
$datos_rango3=0;
$datos_rango2=0;
$datos_rango1=0;
$datos_rango0=0;
$datos_rango00=0;
$datos_rango11=0;
$datos_total=0;
# ADQUIRE DATA PASSED AS FORM PARAMETERS
# ======================================
# Purge data using dates
# Purge data using dates
if (isset($_POST["purgedb"])) {
$from_date = get_parameter_post ("date_purge");
if (isset($id_agent)){
if ($id_agent != -1) {
echo __('Purge task launched for agent id ').$id_agent." / ".$from_date;
echo "".__('Please be patient. This operation can be very long in time (5-10 minutes)')."
",__('while deleting data for ').__('Agent')."
";
if ($id_agent == 0) {
$sql="SELECT * FROM tagente_modulo";
} else {
$sql=sprintf("SELECT * FROM tagente_modulo WHERE id_agente = %d",$id_agent);
}
$result=get_db_all_rows_sql($sql);
foreach ($result as $row) {
echo __('Deleting records for module ').dame_nombre_modulo_agentemodulo($row["id_agente_modulo"]);
flush();
//ob_flush();
echo "
";
$sql = sprintf("DELETE FROM `tagente_datos` WHERE `id_agente_modulo` = '%d' AND `timestamp` < '%s'",$row["id_agente_modulo"],$from_date);
process_sql ($sql);
$sql = sprintf("DELETE FROM `tagente_datos_inc` WHERE `id_agente_modulo` = '%d' AND `timestamp` < '%s'",$row["id_agente_modulo"],$from_date);
process_sql ($sql);
$sql = sprintf("DELETE FROM `tagente_datos_string` WHERE `id_agente_modulo` = '%d' AND `timestamp` < '%s'",$row["id_agente_modulo"],$from_date);
process_sql ($sql);
}
} else {
echo __('Deleting records for module ').__('All agents');
flush();
//ob_flush();
$query = sprintf("DELETE FROM `tagente_datos` WHERE `timestamp` < '%s'",$from_date);
process_sql ($query);
$query = sprintf("DELETE FROM `tagente_datos_inc` WHERE `timestamp` < '%s'",$from_date);
process_sql ($query);
$query = sprintf("DELETE FROM `tagente_datos_string` WHERE `timestamp` < '%s'",$from_date);
process_sql ($query);
}
echo "
";
}
}
# Select Agent for further operations.
?>