php warnings
[Pman.MTrack] / TestDayMail.php
1 <?php
2 /**
3
4 designed to test if we can send a mail every day summarizing what has changed.
5
6 */
7 require_once 'Pman/Core/Cli.php';
8 class Pman_MTrack_TestDayMail extends Pman_Core_Cli
9 {
10     static $cli_desc = "Test sendout of a daily email for mtrack";
11     function getAuth()
12     {
13         return true;
14     }
15     function get($base, $opts= array())
16     {
17         die("not used");
18         echo '<style>' . file_get_contents(__DIR__ . '/templates/css/code.diff.css' ).
19             '</style>';
20         $r = DB_DataObject::factory('mtrack_repos');
21         $r->find();
22         while ($r->fetch()) {
23             $p = DB_DAtaObject::factory('Person');
24             $p->whereAddIn('email', array('alan@roojs.com' ), 'string');
25             foreach($p->fetchAll('id') as $pid) {
26                 $cw = DB_DAtaObject::Factory('core_watch');
27                 $cw->setFrom(array(
28                     
29                     'ontable' => 'mtrack_repos',
30                     'onid' => $r->id,
31                     'person_id' => $pid,
32
33                     // event
34                     'medium' => 'ENDOFDAYMAIL',
35                     'active' => true,
36
37                     
38                 ));
39                 
40                 if (!$cw->count()) {
41                     $cw->insert();
42                 }
43             }
44         }
45         die("ADDED");           
46             
47       /*        
48         
49             
50             $c = DB_DataObject::factory('mtrack_change');
51             $c->ontable = $r->tableName();
52             $c->onid = $r->id;
53             $c->whereAdd('changedate > NOW() - INTERVAL 1 DAY');
54             
55             if (!$c->count()) {
56                 continue;
57             }
58             echo $r->shortname . "\n";
59             $rcpt = DB_DataObject::Factory('Person');
60             $rcpt->get('email' , 'alan@roojs.com');
61             $r->notifyENDOFDAYMAIL($rcpt, date("Y-m-d", strtotime("YESTERDAY")), false, false);
62             
63         }
64     */
65     }
66     
67 }