From b94f9af24f1dff4439051787adb6d2a60ed291ad Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 2 Nov 2004 15:09:09 +0000 Subject: - Patch #12455 by Steven: optimized SQL query. This problem caused Drupal.org's cron runs to time out. --- modules/statistics.module | 2 +- modules/statistics/statistics.module | 2 +- modules/watchdog.module | 2 +- modules/watchdog/watchdog.module | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/statistics.module b/modules/statistics.module index 895f0083b..c2645d434 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -487,7 +487,7 @@ function statistics_cron() { } /* clean expired access logs */ - db_query('DELETE FROM {accesslog} WHERE '. time() .' - timestamp > '. variable_get('statistics_flush_accesslog_timer', 259200)); + db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200)); } /** diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 895f0083b..c2645d434 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -487,7 +487,7 @@ function statistics_cron() { } /* clean expired access logs */ - db_query('DELETE FROM {accesslog} WHERE '. time() .' - timestamp > '. variable_get('statistics_flush_accesslog_timer', 259200)); + db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200)); } /** diff --git a/modules/watchdog.module b/modules/watchdog.module index 31e305242..89f2d4f70 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -74,7 +74,7 @@ function watchdog_perm() { * Remove expired log messages. */ function watchdog_cron() { - db_query('DELETE FROM {watchdog} WHERE '. time() .' - timestamp > '. variable_get('watchdog_clear', 604800)); + db_query('DELETE FROM {watchdog} WHERE timestamp < %d', time() - variable_get('watchdog_clear', 604800)); } /** diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 31e305242..89f2d4f70 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -74,7 +74,7 @@ function watchdog_perm() { * Remove expired log messages. */ function watchdog_cron() { - db_query('DELETE FROM {watchdog} WHERE '. time() .' - timestamp > '. variable_get('watchdog_clear', 604800)); + db_query('DELETE FROM {watchdog} WHERE timestamp < %d', time() - variable_get('watchdog_clear', 604800)); } /** -- cgit v1.2.3