Version events
Fired around the publish or unpublish of an MC\DownloadsManager\Entity\DownloadVersion. These are independent of the parent download's download_state. A moderated download can have published versions, and a visible download can have unpublished drafts.
Events
| Event | Signature | When |
|---|---|---|
mc_dm_version_pre_publish | (DownloadVersion $version) | Before is_published flips false to true. |
mc_dm_version_post_publish | (DownloadVersion $version) | After publish commits. |
mc_dm_version_unpublish | (DownloadVersion $version) | When is_published flips true to false. |
Notes on the publish axis
is_publishedis independent ofFile.validation_status. A published version may carry files still being processed.is_published = falseroutes the version through the approval queue. Only setfalsefor genuinely-awaiting-mod cases. For author drafts, keepis_published = trueand gate via the parentDownload.download_state = 'draft'.
Typical use cases
- Notify watchers on
post_publish. SeeMC\DownloadsManager\Notifier\Version\NewVersiononce notifications ship. - Build changelog entries on
pre_publish. Read the previous version's metadata before the new one becomes the current version. - Trigger external CI on
post_publish. Send a webhook to a build system or external sync target.
Example
public static function versionPostPublish(\MC\DownloadsManager\Entity\DownloadVersion $version)
{
$download = $version->Download;
\XF::app()->jobManager()->enqueue(
\YourAddon\Job\NotifyExternalSites::class,
['version_id' => $version->version_id]
);
}