[TYPO3-dev] Email Notification - Cron or Hooks?

Gerrit Kamp gerrit.kamp at kampconsulting.com
Wed Aug 22 18:15:42 CEST 2007


Team,

 

I am working on quite a large web-application for a large oil company, and I
use Typo3 as the development framework (I see Typo3 and LAMP not just as a
CMS, but actually as an alternative to Microsoft's .NET, just better and
cheaper).

 

I am not allowed to publish much of it as public extensions, but there is
one neat feature that I do want to make available. It is an advanced email
notification system with the following features:

- Users can indicate which type of events they want to be notified of
through an FE screen. These events are fully configurable by a system admin,
any DB change can trigger an event.

- A cron job runs in the background, checking every hour (or whatever
timeframe you want) if any relevant event occurred and then it sends out
emails to those users who wish to be notified.

- Configuration and testing of the events (the SQL to find the relevant
events) is done separately through an FE screen.

 

I think I could have used Hooks instead of a cron job for the triggering of
events. My thinking is that hooks are triggered directly by user Events
(changes to certain DB records) and thus they actually would impact
performance of the system at the moment the user is doing something. Since
the overhead of Typo3 already causes a little delay in pages being
displayed, I want to keep this type of performance-killers to a minimum. But
I don't know enough about hooks to justify this decision.

 

So, my question is, has the triggering of an event through hooks
(processDatamap_postProcessFieldArray, callUserFunc) any impact on
performance for FE users? Or will this actually be executed after the page
has been displayed? The benefit of the cron approach is that it runs once
every hour for a few seconds only rather then every time a user does
something in the system. The benefits of using the hooks are that the users
of the extension do not have to add a job to their crontab and it's easier
to make the code fully compliant to the coding guidelines (right now I use a
php cron script that does not fully utilize the Typo3DB classes, but I guess
I could change that).

 

I look forward to your response,

 

Cheers,

 

Gerrit





More information about the TYPO3-dev mailing list