Import and the event system
In certain circumstances, importing content into a Content Manager can trigger one or more Event Handlers that you created in the Event System to be applied on the imported items. This may be desirable behavior, but in the Import and Export service API, the Event System detects whether a new or updated item is the result of an import, and you can modify your Event Handler(s) to catch these kinds of events and treat them separately.
An Event Handler can be triggered if the following conditions apply:
- You are importing content into a destination Content Manager.
- Content Porter performs actions during the import, such as creating items, updating items, etc, that have event triggers associated with them.
If this is the case, then by default, imported items automatically trigger the events associated with these actions. If the number of imported items triggering events is large, this can be undesirable. Furthermore, Content Porter may not perform a truly transactional import if these conditions apply, because it cannot undo the triggered events.
- When you are importing, you can modify your Event Handler to detect whether an event is triggered by an import, and respond accordingly.
- Alternatively, you can temporarily disable the event triggers for the duration of the import, and reenable them after the import is done. Note that no users should handle content while the import is running, because their actions will not trigger the desired events.