Skip to main content

Lifecycle events

Downloads Manager fires named code events at every meaningful point in the download, version, file, and gate lifecycle. Subscribe to them via the standard event-listener system: AdminCP > Development > Code event listeners, or via XML in _output/code_event_listeners/.

Events are wired even when no built-in subscriber exists. Third parties can hook into them today.

Full event list

Registry handlers

Bound on the container in Listener::appSetup(). The handlers fire lazily — the first time the registry is resolved ($container->get('mc_dm.gate_registry') etc.) — not at boot. In practice that means subscribers run on the first request that needs the registry.

EventSignaturePurpose
mc_dm_gate_handlers(GateRegistry $registry)Register gates.
mc_dm_processor_handlers(ProcessorRegistry $registry)Register file processors.
mc_dm_source_handlers(SourceRegistry $registry)Register external sources.
mc_dm_stats_handlers(StatsRegistry $registry)Register stats consumers.

Download lifecycle

See Download events for full signatures.

  • mc_dm_download_pre_create
  • mc_dm_download_post_create
  • mc_dm_download_pre_save
  • mc_dm_download_post_save
  • mc_dm_download_pre_delete
  • mc_dm_download_post_delete

Version lifecycle

See Version events.

  • mc_dm_version_pre_publish
  • mc_dm_version_post_publish
  • mc_dm_version_unpublish

File lifecycle

See File events.

  • mc_dm_file_pre_upload
  • mc_dm_file_post_upload
  • mc_dm_file_pre_serve
  • mc_dm_file_post_serve
  • mc_dm_download_started
  • mc_dm_download_completed
  • mc_dm_download_failed

Gate evaluation

See Gate events.

  • mc_dm_gate_passed
  • mc_dm_gate_failed
  • mc_dm_gate_all_passed (added in 1.0.0)

Comment lifecycle

See Comment events.

  • mc_dm_comment_post_save
  • mc_dm_comment_post_delete
  • mc_dm_thread_settings_changed

Review lifecycle

See Review events.

  • mc_dm_review_pre_create
  • mc_dm_review_post_create
  • mc_dm_review_pre_save
  • mc_dm_review_post_save
  • mc_dm_review_pre_delete
  • mc_dm_review_post_delete
  • mc_dm_review_state_change
  • mc_dm_review_notifications_dispatched
  • mc_dm_review_author_reply_added
  • mc_dm_review_author_reply_removed
  • mc_dm_review_author_reply_dispatched

Team lifecycle

See Team events.

  • mc_dm_team_member_added
  • mc_dm_team_member_updated
  • mc_dm_team_member_removed

Share token lifecycle

See Share token events.

  • mc_dm_share_token_issued
  • mc_dm_share_token_used
  • mc_dm_share_token_revoked

Subscribing

In _output/code_event_listeners/<id>.json:

{
"event_id": "mc_dm_download_post_save",
"execute_order": 10,
"callback_class": "YourVendor\\YourAddon\\Listener",
"callback_method": "downloadPostSave",
"active": true
}

In your listener class:

public static function downloadPostSave(\MC\DownloadsManager\Entity\Download $download)
{
// ...
}