Triggers
Triggers are a means of defining a function that will be called at a particular execution point (often referred to as a hook). EPrints repository software facilitates this as often a repository may want to carry out a particular task when a specific event occurs (or is about to occur). EPrints has many different types of trigger some are generic and some are applied to specific dataset. The following are those most commonly implemented:
Repository Triggers
- EP_TRIGGER_LOG - When logging messages to standard error
- EP_TRIGGER_BOILERPLATE_RDF - When generating the boilerplate RDF for the repository
- EP_TRIGGER_REPOSITORY_RDF - When generating repository specific RDF.
- EP_TRIGGER_BEGIN - When an
EPrints::Repository
object is created. - EP_TRIGGER_BEGIN_REQUEST - At the start of an HTTP request being processed.
- EP_TRIGGER_END_REQUEST - At the end of processing an HTTP request.
- EP_TRIGGER_END - Just before an
EPrints::Repository
object is destroyed. - EP_TRIGGER_DOC_URL_REWRITE - Rewriting an URL for a document so it can be responded to with the correct resource.
- EP_TRIGGER_MEDIA_INFO - When extracting media information about a file (e.g. MIME type, resolution if image/video, duration if audio/video, etc.)
- EP_TRIGGER_INDEX_FIELDS - When fields are being indexed.
- EP_TRIGGER_INDEX_REMOVED - When fields are being removed from the index.
- EP_TRIGGER_URL_REWRITE - Rewriting an URL so it can be responded to with the correct resource.
- EP_TRIGGER_VALIDATE_FIELD - When a metadata field is being validated.
- EP_TRIGGER_LOCAL_SITEMAP_URLS - When generating URLs to add to the repository sitemap (i.e. sitemap.xml)
- EP_TRIGGER_DYNAMIC_TEMPLATE - When the dynamic template for a web page response to a request is being generated
- EP_TRIGGER_THUMBNAIL_TYPES - When determining what thumbnails types to generate for (a) file(s) associated with a document,
Dataset Triggers
- EP_TRIGGER_CREATED - When a new data object is being created.
- EP_TRIGGER_RDF - When RDF for a data object is being generated.
- EP_TRIGGER_DEFAULTS - When a new data object is setting its default values
- EP_TRIGGER_STATUS_CHANGE - When the status of a data object changes, (e.g. when an eprint is moved to the live archive).
- EP_TRIGGER_BEFORE_COMMIT - Just before the changes to a data object are saved to the database.
- EP_TRIGGER_AFTER_COMMIT - Just after the changes to a data object have been saved to the database.
- EP_TRIGGER_VALIDATE - When the data object fields are being checked for their validity.
- EP_TRIGGER_WARNINGS - When a data objects is generating warnings about its state (e.g. missing or inappropriate metadata field values).
- EP_TRIGGER_FILES_MODIFIED - When a file associated with a data object has been modified (e.g. new thumbnails will need to be generated if the file they are based on has changed or added).
- EP_TRIGGER_REMOVED - When a data object is destroyed.
};
EP_TRIGGER_BEGIN_REQUEST
EP_TRIGGER_BOILERPLATE_RDF EP_TRIGGER_END_REQUEST
EP_TRIGGER_REPOSITORY_RDF
EP_TRIGGER_END_REQUEST EP_TRIGGER_URL_REWRITE EP_TRIGGER_DOC_URL_REWRITE
EP_TRIGGER_STATUS_CHANGE EP_TRIGGER_BEFORE_COMMIT EP_TRIGGER_AFTER_COMMIT EP_TRIGGER_VALIDATE EP_TRIGGER_VALIDATE_FIELD EP_TRIGGER_WARNINGS EP_TRIGGER_FILES_MODIFIED EP_TRIGGER_MEDIA_INFO EP_TRIGGER_THUMBNAIL_TYPES EP_TRIGGER_INDEX_FIELDS EP_TRIGGER_INDEX_REMOVED EP_TRIGGER_DYNAMIC_TEMPLATE EP_TRIGGER_LOCAL_SITEMAP_URLS