dblog_cron

Versions
6 – 7
dblog_cron()

Implement hook_cron().

Remove expired log messages and flood control events.

Code

modules/dblog/dblog.module, line 93

<?php
function dblog_cron() {
  // Cleanup the watchdog table
  if (variable_get('dblog_row_limit', 1000) > 0) {
    $max = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
    db_delete('watchdog')
      ->condition('wid', $max - variable_get('dblog_row_limit', 1000), '<=')
      ->execute();
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.