From 55cc439990e27c75cc233a65dd23b363cabe66b4 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 2 Oct 2007 07:05:43 +0000
Subject: [PATCH] - Patch #178044 by chx: properly delete watchdog messages
 captured by the dblog.module.

---
 modules/dblog/dblog.module | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 32fc270b643e..83dcd23091bd 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -97,15 +97,8 @@ function dblog_init() {
  */
 function dblog_cron() {
   // Cleanup the watchdog table
-  $min = db_result(db_query('SELECT MIN(wid) FROM {watchdog}'));
-  if ($min) {
-    $max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
-    if ($max) {
-      if (($max - $min) > variable_get('dblog_row_limit', 1000)) {
-        db_query('DELETE FROM {watchdog} WHERE wid < %d', $max - $min);
-      }
-    }
-  }
+  $max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
+  db_query('DELETE FROM {watchdog} WHERE wid < %d', $max - variable_get('dblog_row_limit', 1000));
 }
 
 /**
-- 
GitLab