/[drupal]/contributions/modules/subscription/contrib.examples/watchdognotify.module
ViewVC logotype

Diff of /contributions/modules/subscription/contrib.examples/watchdognotify.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Fri Sep 23 14:29:09 2005 UTC revision 1.3, Mon Dec 5 13:56:19 2005 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* $Id: watchdognotify.module,v 1.1 2005/08/28 17:29:12 ee Exp $ */  /* $Id: watchdognotify.module,v 1.2 2005/09/23 14:29:09 ee Exp $ */
3  /**  /**
4  * Implementation of hook_menu().  * Implementation of hook_menu().
5  */  */
# Line 8  function watchdognotify_menu($may_cache) Line 8  function watchdognotify_menu($may_cache)
8    $items = array();    $items = array();
9    $items[] = array('path' => 'subscription/add/watchdog',    $items[] = array('path' => 'subscription/add/watchdog',
10      'title' => t('add watchdog subscription'),      'title' => t('add watchdog subscription'),
11      'access' => true,      'access' => user_access('access administration pages'),
12      'callback' => 'watchdognotify_subscribe',      'callback' => 'watchdognotify_subscribe',
13      'type' => MENU_CALLBACK);      'type' => MENU_CALLBACK);
14     return $items;     return $items;
# Line 20  function watchdognotify_subscribe() { Line 20  function watchdognotify_subscribe() {
20    drupal_goto('user/'.$user->uid.'/subscriptions');    drupal_goto('user/'.$user->uid.'/subscriptions');
21  }  }
22  /*  /*
23  * Implement hook_subscrition();  * Implement hook_subscription();
24  */  */
25  function watchdognotify_subscription($op, $arg1 = null, $arg2 = null) {  function watchdognotify_subscription($op, $arg1 = null, $arg2 = null) {
26    if ($op == 'cron') {    if ($op == 'cron') {
# Line 36  function watchdognotify_subscription($op Line 36  function watchdognotify_subscription($op
36      $formatters[] = array('name' => 'Watchdog formatter', 'object' => 'watchdog', 'channel' => '*', 'weight' => 20, 'handler' => 'watchdognotify_formatter');      $formatters[] = array('name' => 'Watchdog formatter', 'object' => 'watchdog', 'channel' => '*', 'weight' => 20, 'handler' => 'watchdognotify_formatter');
37      return $formatters;      return $formatters;
38    }    }
39    if ($op == 'special') {    if ($op == 'special' && user_access('access administration pages')) {
40        return '<p>'.l("Subscribe to errors", 'subscription/add/watchdog').'</p>';        return l('Subscribe to significant site errors', 'subscription/add/watchdog');
41    }    }
42  }  }
43  function watchdognotify_formatter($object, $type) {  function watchdognotify_formatter($object, $type) {
44   return wordwrap('['. format_date($object['timestamp'], 'small') .']['. $object['hostname'] .']ERROR: '. $object['message'] ."\n", 72);   return wordwrap('['. format_date($object['timestamp'], 'small') .']['. $object['hostname'] .']ERROR: '. $object['message'] ."\n", 72);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2