Only in ../../../DRUPAL-5/contributions/modules/civicrm_error/: 324445-civicrm_error-formatting+watchdog+codestandards.11.patch Only in ../../../DRUPAL-5/contributions/modules/civicrm_error/: 324445-civicrm_error-formatting+watchdog.4.patch Only in ../../../DRUPAL-5/contributions/modules/civicrm_error/: 324445-civicrm_error-formatting+watchdog.9.patch Only in ../../../DRUPAL-5/contributions/modules/civicrm_error/: CVS diff -ur ../../../DRUPAL-5/contributions/modules/civicrm_error/civicrm_error.info civicrm_error/civicrm_error.info --- ../../../DRUPAL-5/contributions/modules/civicrm_error/civicrm_error.info 2007-07-21 03:44:34.000000000 +1200 +++ civicrm_error/civicrm_error.info 2009-06-28 22:14:34.000000000 +1200 @@ -2,4 +2,6 @@ name = CiviCRM Error Handler description = Custom error handling for CiviCRM. Will email critical errors to you. package = CiviCRM -dependencies = civicrm +dependencies[] = civicrm + +core = 6.x \ No newline at end of file diff -ur ../../../DRUPAL-5/contributions/modules/civicrm_error/civicrm_error.module civicrm_error/civicrm_error.module --- ../../../DRUPAL-5/contributions/modules/civicrm_error/civicrm_error.module 2009-06-28 22:18:01.000000000 +1200 +++ civicrm_error/civicrm_error.module 2009-06-29 23:00:04.000000000 +1200 @@ -61,7 +61,6 @@ // send email // log error - $subject = 'CiviCRM error at '. $site; $to = variable_get('civicrm_error_to', variable_get("site_mail", ini_get("sendmail_from"))); $errors_via = variable_get('civicrm_error_via', 'both') ; @@ -73,11 +72,31 @@ watchdog('civicrm_error', 'CiviCRM Error:
'. $output .'
') ; // continue to "email" case here case "email": - drupal_mail('civicrm_error', $to, $subject, $output); +// drupal_mail('civicrm_error', $to, $subject, $output); + /* TODO Create a hook_mail($key, &$message, $params) function to generate + the message body when called by drupal_mail. */ + $account = array(); // Set this as needed + $language = user_preferred_language($account); + $object = array(); // Replace this as needed + $context['subject'] = $subject; + $context['body'] = $output; + $params = array('account' => $account, 'object' => $object, 'context' => $context); + drupal_mail('civicrm_error', 'civicrm_error', $to, $language, $params); break ; } } +function civicrm_error_mail($key, &$message, $params) { + $language = $message['language']; + $variables = user_mail_tokens($params['account'], $language); + switch($key) { + case 'civicrm_error': + $message['subject'] = t('CiviCRM error report from !site', $variables, $language->language); + $message['body'][] = $params['context']['body']; + break; + } +} + /** * Helper function to return a pretty print of the given array */ @@ -113,19 +132,16 @@ /** * Implementation of hook_menu(). */ -function civicrm_error_menu($may_cache) { +function civicrm_error_menu() { $items = array(); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/logs/civicrm_error', - 'title' => t('CiviCRM Error Handler'), - 'description' => t('Email critical CiviCRM errors.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => 'civicrm_error_settings', - 'access' => user_access('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - } + $items['admin/reports/civicrm_error'] = array( + 'title' => 'CiviCRM Error Handler', + 'description' => 'Configure reporting for CiviCRM errors.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('civicrm_error_settings'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); return $items; } @@ -144,9 +160,9 @@ '#type' => 'select', '#title' => t('Errors via'), '#options' => array( - 'both' => 'Email and Watchdog', + 'both' => 'Email and Watchdog', 'watchdog' => 'Watchdog only', - 'email' => 'Email only' + 'email' => 'Email only' ), '#default_value' => variable_get('civicrm_error_via', 'both'), '#description' => t("Method for error delivery."),