Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Notification events

This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!

The following three notification events are supported by default:

  • Publish
  • Collaboration
  • Current time

Publish

Every time an object is published, a new "ezpublish" event is created.

Collaboration

Every time a collaboration message is generated, a new "ezcollaboration" event is created.

Current time

Every time the " runcronjobs.php" script is executed, a new "ezcurrenttime" event is created. This behavior is specified in the "cronjobs/notification.php" file. The system uses "ezcurrenttime" events for generating digest notifications.

If you need to generate this event manually, add the "notification/runfilter" notation to the URL of your site administration interface and then click the "Spawn time event" button. Please note that the "runfilter" view of the "notification" module should be used only for testing and debugging.

The built-in notification event types are stored in the "kernel/classes/notification/event/" directory. It is possible to extend the system by creating custom notification events for special needs.

Creation and storage

Let's say that you have an article on your site, and a user has subscribed for subtree notifications about this article. Every time a new comment is posted or an updated version of the article is published, the system will generate a new "ezpublish" event and store it in the database. This event can be processed by zero, one, or more notification handlers.

Settings

The available notification event types are specified in the "[NotificationEventTypeSettings]" section of the " notification.ini" configuration file located in the "settings" directory. The following settings can be used under this section:

The "RepositoryDirectories[]" array specifies the directories where eZ Publish will search for built in notification event types. The exact location of the event in the directory is specified using the "AvailableNotificationEventTypes" setting.

The "ExtensionDirectories[]" array specifies the extension directories where eZ Publish will search for additional notification event types. By default eZ Publish will search in the "notificationtypes" subdirectory inside your extension. The exact location of the event in this subdirectory is specified with the "AvailableNotificationEventTypes" setting.

The "AvailableNotificationEventTypes[]" array contains a list of event types.

Example 1

The following lines can be specified in the " notification.ini" configuration file:

[NotificationEventTypeSettings]
RepositoryDirectories[]=kernel/classes/notification/event/
ExtensionDirectories[]
AvailableNotificationEventTypes[]=ezpublish
AvailableNotificationEventTypes[]=ezcurrenttime
AvailableNotificationEventTypes[]=ezcollaboration

These settings will make eZ Publish search for the following files for built in notification events:

  • kernel/classes/notification/event/ezpublish/ezpublishtype.php
  • kernel/classes/notification/event/ezcurrenttime/ezcurrenttimetype.php
  • kernel/classes/notification/event/ezcollaboration/ezcollaborationtype.php

Example 2

You can extend the system by creating custom notification events. For example, if you have an extension "nExt" that includes a notification event "nev", put the following lines into an override for " notification.ini" configuration file:

[NotificationEventTypeSettings]
ExtensionDirectories[]=nExt
AvailableNotificationEventTypes[]=nev

or

[NotificationEventTypeSettings]
RepositoryDirectories[]=extension/nExt/notificationtypes/
AvailableNotificationEventTypes[]=nev

These settings will make eZ Publish expect the additional notification event to be located at
"extension/nExt/notificationtypes/nev/nevtype.php"

Please note that you must always clear at least the ini cache in order to make the system re-read the changed configuration files.

Svitlana Shatokhina (10/02/2006 8:30 am)

Ricardo Correia (17/04/2013 3:20 pm)

Balazs Halasy, Ricardo Correia


Comments

There are no comments.