XenForo Resource Manager (XFRM)
Migrates an existing XenForo Resource Manager 2.3+ library on the same XF installation into Downloads Manager.
Because the source is the current XF database, no external connection is needed. User IDs, attachment data rows, tag IDs, and content-vote rows are reused directly.
Requirements
- XenForo Resource Manager 2.3.0 or newer, installed and active.
- Source data lives in the current XF database (
xf_rm_*tables).
Base configuration
The XFRM importer has no base-configuration fields. The only validation performed at this stage is:
- XFRM is installed and active.
- XFRM is at version 2.3.0 (
version_id ≥ 2030031) or newer.
If either check fails, the import will not proceed.
Step configuration
The configuration screen lists every XFRM category, prefix group, prefix, and custom field with a per-row choice of:
- A target Downloads Manager record to map to, or
- Create new, or
- Skip.
It also exposes three flags:
| Flag | Default | Effect |
|---|---|---|
| Import non-visible resources | off | When off, only resource_state='visible' rows are imported. When on, moderated and deleted rows come across too (their state is preserved on the Downloads Manager side). |
| Import reviews | on | When on, xf_rm_resource_rating is migrated to xf_mc_dm_review, and helpful-vote rows in xf_content_vote are re-anchored from content_type='resource_rating' to content_type='mc_dm_review'. |
| Import watchers | on | When on, xf_rm_resource_watch is migrated to xf_mc_dm_download_watch. |
Step list
Steps execute in dependency order. Most are bounded by MAX(id) on the source table, so progress percentages reflect the actual workload.
| # | Step | Source table | Notes |
|---|---|---|---|
| 1 | categories | xf_rm_category | Walked by lft so parents are inserted before children. Nested-set and breadcrumb caches are rebuilt at end-of-step. |
| 2 | prefixGroups | xf_rm_resource_prefix_group | Titles read from the resource_prefix_group.<id> master phrase. |
| 3 | prefixes | xf_rm_resource_prefix | Titles read from the resource_prefix.<id> master phrase. Allowed-category list is remapped through the new category IDs. |
| 4 | fields | xf_rm_resource_field | String IDs are converted to unique DM field IDs (25-char max) when collisions exist. field_choices and match_params are unserialised. |
| 5 | resources | xf_rm_resource | Imports the resource itself plus the description from the resource's description_update_id. State is normalised to visible / moderated / deleted. |
| 6 | versions | xf_rm_resource_version | Sorted by release_date (used as version_int proxy) so the newest version shows first in DM. Changelog is left empty — XFRM has no version-to-update FK; admins can populate post-import. |
| 7 | files | xf_attachment where content_type='resource_version' | Each binary is streamed out via Flysystem, copied to a temp file, hashed (sha256), and re-stored via MC\DownloadsManager\Util\Storage::store under DM's PathScheme layout. Missing source files are logged and skipped. |
| 8 | icons | xf_rm_resource where icon_date > 0 | Each icon is fed through Service\Download\Icon::setImage() / updateIcon() so DM's full variant set is generated. |
| 9 | fieldValues | xf_rm_resource_field_value | Bulk-inserted into xf_mc_dm_field_value using the new download/field IDs. |
| 10 | reviews | xf_rm_resource_rating | Mapped to xf_mc_dm_review. Helpful-vote rows in xf_content_vote are re-anchored to content_type='mc_dm_review' at end-of-step. Requires the matching version to have been imported. |
| 11 | watchers | xf_rm_resource_watch | Bulk-inserted into xf_mc_dm_download_watch. |
| 12 | attachments | xf_attachment where content_type='resource_update' | Description/changelog attachments. A new xf_attachment row is inserted with content_type='mc_dm_download', and [ATTACH]<id>[/ATTACH] markers in the download description and version changelogs are rewritten to the new attachment ID. |
| 13 | tags | xf_tag_content where content_type='resource' | Bulk-inserted with content_type='mc_dm_download'. |
Notes and caveats
- Same-DB import —
xf_attachment_datarows are reused; onlyxf_attachmentmapping rows are duplicated. No physical file is copied for description/changelog attachments. For version files, the binary is copied to DM's storage layout because DM uses its own path scheme rather thanxf_attachment_data. - Version changelogs are empty — there is no FK from
xf_rm_resource_versionto its own update post, so the importer cannot reliably populate per-version changelogs. The resource's overall description is imported once on the parent download. - Counters — category counter caches are rebuilt at the end of the
resourcesstep. The XFRM source counters (downloads, views, ratings) are copied verbatim onto the new download row. - State mapping — XFRM
version_state='moderated'collapses to DMversion_state='visible'; moderation is captured at the download level. Reviewrating_state='moderated'similarly collapses tovisible. - No prefix-group de-duplication — every XFRM prefix group is its own row. If you map one to an existing DM group, child prefixes follow the mapping.