? clear_log.patch Index: mail_logger.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mail_logger/Attic/mail_logger.module,v retrieving revision 1.1.4.3 diff -u -p -r1.1.4.3 mail_logger.module --- mail_logger.module 6 Feb 2010 23:11:03 -0000 1.1.4.3 +++ mail_logger.module 7 Feb 2010 19:07:43 -0000 @@ -71,9 +71,6 @@ function theme_mail_logger_read_mail($ma * Purpose of this function is to log all outgoing mail */ function mail_logger_mail_alter(&$message) { -// &$mailkey, &$to, &$subject, &$body, &$from, &$headers = '' -//drupal_set_message('
'. print_r($message, 1) .'
'); -//return ; //this line taken from mail.inc:drupal_mail() $message['body'] = is_array($message['body']) ? drupal_wrap_mail(implode("\n\n", $message['body'])) : drupal_wrap_mail($message['body']); $args = array( @@ -106,6 +103,8 @@ function _mail_logger_get_mailkey_types( return $types; } + + function mail_logger_form_overview() { $names['all'] = t('all mail types'); foreach (_mail_logger_get_mailkey_types() as $type) { @@ -141,12 +140,18 @@ function mail_logger_form_overview_submi */ function theme_mail_logger_form_overview($form) { return '
'. drupal_render($form) .'
'; +} + +function theme_mail_logger_clear_form($form) { + return '
'; } + /** * Menu callback; displays a listing of log mails. */ function mail_logger_overview() { $output = drupal_get_form('mail_logger_form_overview'); + $output .= drupal_get_form('mail_logger_clear_form'); $header = array( array('data' => t('Date Sent'), 'field' => 'ml.date_sent', 'sort' => 'desc'), @@ -192,3 +197,21 @@ function mail_logger_overview() { return $output; } + +/* + * clear log + * + */ + +function mail_logger_clear_form($form_state) { + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Clear log')); + $form['#redirect'] = FALSE; + return $form; +} + +function mail_logger_clear_form_submit($form, &$form_state) { + db_query('TRUNCATE TABLE {mail_logger}'); + drupal_set_message(t('Mail log cleared.')); +}