Same name and namespace in other branches
  1. 7.x modules/dblog/dblog.admin.inc \dblog_top()

Menu callback; generic function to display a page of the most frequent dblog events of a specified type.

2 string references to 'dblog_top'
dblog_menu in modules/dblog/dblog.module
Implementation of hook_menu().
search_menu in modules/search/search.module
Implementation of hook_menu().

File

modules/dblog/dblog.admin.inc, line 103
Administrative page callbacks for the dblog module.

Code

function dblog_top($type) {
  $header = array(
    array(
      'data' => t('Count'),
      'field' => 'count',
      'sort' => 'desc',
    ),
    array(
      'data' => t('Message'),
      'field' => 'message',
    ),
  );
  $result = pager_query("SELECT COUNT(wid) AS count, message, variables FROM {watchdog} WHERE type = '%s' GROUP BY message, variables " . tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(message)) FROM {watchdog} WHERE type = '%s'", $type);
  $rows = array();
  while ($dblog = db_fetch_object($result)) {
    $rows[] = array(
      $dblog->count,
      truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No log messages available.'),
        'colspan' => 2,
      ),
    );
  }
  $output = theme('table', $header, $rows);
  $output .= theme('pager', NULL, 30, 0);
  return $output;
}