View Issue Details

IDProjectCategoryView StatusLast Update
0025953mantisbtplug-inspublic2019-08-25 12:36
Reporterdregad Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version2.22.0Fixed in Version2.22.0 
Summary0025953: Missing an API function to check if a plugin event has been declared
Description

I need to make a plugin adapt itself to the presence of an event declared by another, optional plugin.

If said plugin is not installed, or is an older version, then MantisBT throws a warning when trying to hook the event (2400: Event "xxx" has not yet been declared).

This could be done manually by checking $g_event_cache for the event, but it would be more elegant if MantisBT core provided a function to abstract that.

TagsNo tags attached.

Activities

Related Changesets

MantisBT: master a7098970

2019-08-03 04:56

dregad


Details Diff
New event_is_declared() function

Note: use isset() instead of array_key_exists() as discussed in PR
https://github.com/mantisbt/mantisbt/pull/1534#discussion_r310346891

Replace usage of isset( $g_event_cache[...] ) elsewhere in event API,
by calls to the new function.

Fixes 0025953
Affected Issues
0025953
mod - core/event_api.php Diff File