You are here

function filelog_ui_cron in File Log 6.2

Implementation of hook_cron().

Remove expired log messages and import new ones.

File

./filelog_ui.module, line 94
Viewer UI for file based logging.

Code

function filelog_ui_cron() {
  $time = time();

  // Cleanup the filelog table
  if ($age = variable_get('filelog_maxage', 2592000)) {
    db_query('DELETE FROM {filelog} WHERE timestamp <= %d', $time - $age);
  }
  if (($freq = variable_get('filelog_import_frequency', 604800)) && $time > variable_get('filelog_last_import', 0) + $freq) {
    module_load_include('inc', 'filelog_ui', 'filelog_ui.admin');
    filelog_ui_import_entries();
    cache_clear_all('filelog_type_registry', 'cache', FALSE);
  }
}