Permalink
Browse files

Clean events. closes #3393

  • Loading branch information...
ddurieux committed Apr 1, 2012
1 parent 61613a8 commit 30c3b3f7362b1906b8b7e21b15d34509612717bc
Showing with 7 additions and 1 deletion.
  1. +7 −1 inc/log.class.php
View
@@ -98,7 +98,7 @@ static function cronCleanlogs() {
$pmConfig = new PluginMonitoringConfig();
$id_restart = 0;
- $a_restarts = $this->find("`action`='restart'", "`id` DESC", 1);
+ $a_restarts = $pmLog->find("`action`='restart'", "`id` DESC", 1);
if (count($a_restarts) > 0) {
$a_restart = current($a_restarts);
$id_restart = $a_restart['id'];
@@ -111,6 +111,12 @@ static function cronCleanlogs() {
$query .= " AND `id` < '".$id_restart."'";
}
$DB->query($query);
+
+ // Clean too events
+ $query = "DELETE FROM `glpi_plugin_monitoring_serviceevents`
+ WHERE UNIX_TIMESTAMP(date) < UNIX_TIMESTAMP()-$secs";
+ $DB->query($query);
+
return true;
}

0 comments on commit 30c3b3f

Please sign in to comment.