1: <?php
2: 3: 4: 5: 6:
7: class Whups_Scheduler extends Horde_Scheduler
8: {
9: protected $_reminders;
10: protected $_runtime;
11: protected $_filestamp = 0;
12:
13: public function run()
14: {
15: $this->_runtime = time();
16:
17:
18: if (filemtime(WHUPS_BASE . '/config/reminders.php') > $this->_filestamp) {
19: $this->_filestamp = $this->_runtime;
20: $this->_reminders = Horde::loadConfiguration('reminders.php', 'reminders', 'whups');
21: }
22:
23: foreach ($this->_reminders as $reminder) {
24: $ds = new Horde_Scheduler_Cron_Date($reminder['frequency']);
25: if ($ds->scheduledAt($this->_runtime)) {
26: if (!empty($reminder['server_name'])) {
27: $GLOBALS['conf']['server']['name'] = $reminder['server_name'];
28: }
29: $vars = new Horde_Variables($reminder);
30: Whups::sendReminders($vars);
31: }
32: }
33: }
34:
35: }
36: