OSTicket Plugin Development, Part 5

Back to part 4

Part 5.  Signals

OSTicket provides a signal routing class that will allow you to subscribe to or to emit a signal.  This class is defined in <INSTALL_ROOT>/include/class.signal.php. This class is fairly well documented, static connect function can be called to subscribed to a signal, static function send can be used to generate a signal.  A quick grep on the directory shows these classes that emit signals:

./ajax.php:Signal::send('ajax.client', $dispatcher);
./api/http.php:Signal::send('api', $dispatcher);
./include/class.mailfetch.php: Signal::send('mail.decoded', $this, $info);
./include/class.mailfetch.php: Signal::send('mail.processed', $this, $vars);
./include/class.orm.php: Signal::send('model.deleted', $this);
./include/class.orm.php: Signal::send('model.created', $this);
./include/class.orm.php: Signal::send('model.updated', $this, $data);
./include/class.cron.php: Signal::send('cron', null);
./include/class.user.php: Signal::send('auth.pwreset.email', $this->getUser(), $info);
./include/class.auth.php: Signal::send('auth.login.failed', null, $info);
./include/class.auth.php: Signal::send('auth.login.succeeded', $staff);
./include/class.auth.php: Signal::send('auth.logout', $staff);
./include/class.auth.php: Signal::send('auth.pwreset.login', $staff);
./include/class.auth.php: Signal::send('auth.pwreset.login', $client);
./include/class.mailparse.php: Signal::send('mail.received', $this, $info);
./include/class.mailparse.php: Signal::send('mail.decoded', $decoder, $info);
./include/class.osticket.php: Signal::send('syslog', null, $info);
./include/class.client.php: Signal::send('auth.pwchange', $this->getUser(), $info);
./include/class.export.php: Signal::send('export.tables', $this, $this->tables);
./include/class.staff.php: Signal::send('auth.pwchange', $this, $info);
./include/class.staff.php: Signal::send('model.modified', $this);
./include/class.staff.php: Signal::send('model.deleted', $this);
./include/class.staff.php: Signal::send('auth.login.succeeded', $user);
./include/class.staff.php: Signal::send('auth.login.failed', null, $info);
./include/class.staff.php: Signal::send('model.created', $staff);
./include/class.staff.php: Signal::send('auth.pwreset.email', $this, $info);
./scp/apps/dispatcher.php:Signal::send('apps.scp', $dispatcher);
./scp/ajax.php:Signal::send('ajax.scp', $dispatcher);

You may find some of these useful for your plugin. Another option would be to add some database triggers that will update your data tables in reaction to some event generated by the OSTicket core system.

***

That’s all folks. Download OSTicket Equipment Plugin to browse the code for more information.

Comments are closed.