3 require_once 'Pman/Roo.php';
5 class Pman_Admin_Report_SendEventErrors extends Pman_Roo
7 static $cli_desc = "Send event errors occured in the last 24 hours";
9 static $cli_opts = array(
11 'desc' => 'group to send to',
18 'desc' => 'list of actions to exclude from report',
28 $ff = HTML_FlexyFramework::get();
37 function get($args, $opts)
41 $this->transObj = DB_DataObject::Factory('core_enum');
43 $this->transObj->query('BEGIN');
45 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
47 if(empty($this->opts['group'])){
48 $this->jerr('Missing group - try add [-t {group name}]');
51 $rcpts = DB_DataObject::factory('groups')->lookupMembers("{$this->opts['group']}",'email');
54 $this->jerr("{$this->opts['group']} does not has any memeber");
57 $events = DB_DataObject::factory('Events');
60 DISTINCT(Events.action) AS action,
61 COUNT(Events.id) AS total
64 $events->whereAdd("Events.event_when > NOW() - INTERVAL 1 DAY");
66 if(!empty($this->opts['exclude'])){
67 $exclude = array_unique(array_filter(array_map('trim', explode(',', $this->opts['exclude']))));
68 print_r($exclude);exit;
71 $events->groupBy('Events.action');
72 $events->orderBy('Events.action ASC');
74 print_r($events->fetchAll('action', 'total'));exit;