Skip to main content

Invision Community 5 (Files)

⚠ Hidden in the current public release. The IC5 importer code is in the source tree but is filtered out of the AdminCP importer list — it will not appear under Tools → Import data. To re-enable it on a dev install, define the PHP constant MC_DMI_INCLUDE_IC5 (e.g. in src/config.php: define('MC_DMI_INCLUDE_IC5', true);). The rest of this page documents the importer as built; it is feature-complete but not yet considered ready for production users.

Migrates an existing Invision Community 5 Downloads/Files library into Downloads Manager. The IC5 database lives on a different installation, so this importer connects to it as an external source over PDO and reads the IC5 uploads/ directory directly from disk.

Requirements

  • An accessible IC5 database (host/user/password/dbname) — read-only access is enough.
  • Read access to the IC5 uploads/ directory from the PHP user running XF.
  • At least one user-mapping source. The IC5 Files importer does not map members on its own — it resolves every IC5 member_id to an XF user_id through either a prior IC5 forum-import log on this XF install, or the manually-populated xf_mc_dm_ic5_user_map table (see User mapping).

⚠ XenForo does not ship an IC5 forum importer. XF's built-in IPS importer only supports Invision Community 4.x — there is no first-party IC5 forum importer. To get a forum-import log, you must either use a third-party IC5 forum importer (one that writes to XF's standard xf_import_log_<n> table), or skip the forum-import step entirely and populate xf_mc_dm_ic5_user_map by hand. Without one of those two sources, the base-config validator will refuse to proceed.

Base configuration

The base-configuration screen takes the following fields:

FieldDescription
Host / Port / Username / Password / DatabasePDO connection details for the IC5 database.
Table prefixIC5 default is ibf_. Leave blank only if IC5 was installed without a prefix.
CharsetDefaults to utf8mb4. Change only if your IC5 install uses a different connection charset.
Files pathAbsolute filesystem path to the IC5 uploads/ directory, as readable by this server. Trailing slashes are stripped.
Forum import logOptional. Name of an xf_import_log_<n> table left behind by a prior IC5 forum import (third-party, since XF itself has no IC5 forum importer — see warning above). Resolves IC5 member IDs to XF user IDs, IC5 topic IDs to XF thread IDs, and IC5 attachment IDs to XF attachment IDs. Leave blank if you have populated xf_mc_dm_ic5_user_map manually instead.

Validation runs the following checks:

  1. Open a PDO connection with the provided credentials.
  2. Fingerprint the schema with SHOW TABLES LIKE '{prefix}downloads_files' — fails with "not an IC5 schema" if the table is not present.
    • Also checks core_applications.app_long_version >= 200000. IC5 codes start at 5xxxxxx, IC4 codes are 6-digit 1xxxxx numbers — this stops an IC4 DB being silently fed into the IC5 importer.
  3. is_dir() + is_readable() on Files path.
  4. If Forum import log is set, confirm the table exists on the XF DB.
  5. Confirm at least one user-mapping source exists (forum-import log row OR xf_mc_dm_ic5_user_map row).

User mapping

Downloads Manager needs an XF user ID for every imported download's author, reviewer, watcher, and tagger. IC5 user IDs are resolved in this order:

  1. xf_mc_dm_ic5_user_map — a table the add-on creates on install. Each row is ic5_member_id → xf_user_id. Populate it by hand (CSV, SQL, etc.) for the IC5 members whose downloads you want to bring across.
  2. Forum import log — the xf_import_log_<n> table produced by a forum-side importer. XenForo does not ship one for IC5, so this only applies when a third-party IC5 forum importer (or, e.g., an IC4 → XF import of a community that has since upgraded to IC5) has already populated such a log on this XF install. When present, it also resolves IC5 topic IDs to XF thread IDs (used by the "Map discussion threads" flag) and IC5 attachment IDs to XF attachment IDs.

If neither source has any entries, the import refuses to proceed.

Auto-matching from the AdminCP

The add-on ships an AdminCP page that auto-matches IC5 members against XF users by email and username, then lets you review every proposed match before saving. With the IC5 importer enabled, navigate to AdminCP → [MC] Downloads Manager → IC5 user mapping:

  1. Configure source DB. Enter the IC5 database connection details (host / port / user / password / database / prefix). The page connects, fingerprints the schema, and shows summary stats: total IC5 members and how many already have a mapping.
  2. Review proposed matches. Click "Review proposed matches". A paginated table appears, one row per IC5 member, showing:
    • Email match (green label) — IC5 core_members.email matched exactly one XF xf_user.email. Auto-checked for save.
    • Username match (yellow label) — IC5 core_members.name matched exactly one XF xf_user.username. Auto-checked for save.
    • Conflict (red label) — email matched one XF user, username matched a different XF user. Radio buttons let you pick which one to use; the row is not saved until you do.
    • No match (grey label) — neither email nor username matched. Disabled for save; falls through to the fallback-user setting at import time.
    • Already mapped (blue label) — row already exists in xf_mc_dm_ic5_user_map; shown for context, not re-saved.
  3. Save. Approved rows are written via INSERT … ON DUPLICATE KEY UPDATE, so re-running the matcher after fixing data on either side is idempotent.

The "Clear the mapping table" button on the landing page wipes xf_mc_dm_ic5_user_map if you want to start over.

Fallback user for unmapped members

The IC5 importer's base-config screen now has a Fallback user for unmapped IC5 members field (username autocomplete). Any IC5 member that the importer cannot resolve through the forum-import log or xf_mc_dm_ic5_user_map is attributed to this XF user — useful for guest accounts, deleted members, or imports where you do not want to hand-map every member. Leave blank to skip those rows (current behaviour).

Populating xf_mc_dm_ic5_user_map manually

The table the add-on creates is intentionally minimal:

CREATE TABLE xf_mc_dm_ic5_user_map (
ic_member_id INT UNSIGNED NOT NULL PRIMARY KEY,
user_id INT UNSIGNED NOT NULL,
KEY (user_id)
);

Populate it however suits your data. Below are the three patterns we expect most installs to use.

1. Match by email (recommended — emails are usually unique on both sides):

-- Run on the XF database. Adjust the IC5 DB/schema name if it differs from `ic5`.
INSERT IGNORE INTO xf_mc_dm_ic5_user_map (ic_member_id, user_id)
SELECT ic.member_id, xf.user_id
FROM ic5.core_members AS ic
INNER JOIN xf_user AS xf
ON xf.email = ic.email
WHERE ic.email <> '' AND xf.email <> '';

2. Match by username (use only if you trust usernames to be unique and identical across both systems):

INSERT IGNORE INTO xf_mc_dm_ic5_user_map (ic_member_id, user_id)
SELECT ic.member_id, xf.user_id
FROM ic5.core_members AS ic
INNER JOIN xf_user AS xf
ON xf.username = ic.name;

3. Manual list — for small libraries or one-off cleanups:

INSERT INTO xf_mc_dm_ic5_user_map (ic_member_id, user_id) VALUES
(42, 1001),
(57, 1002),
(123, 1003);

Tips:

  • The XF DB user does not always have access to the IC5 schema. If a cross-schema JOIN is not possible, export core_members.member_id + email (or name) from the IC5 DB as a CSV, load it into a scratch table on the XF DB, and join from there.
  • INSERT IGNORE lets you re-run the same statement after fixing edge cases without tripping the primary-key constraint.
  • After populating, sanity-check the row count: SELECT COUNT(*) FROM xf_mc_dm_ic5_user_map; should be close to the count of IC5 members whose content you actually want to migrate.
  • IC5 members with no matching XF user can be left out — the importer skips downloads owned by unmapped members (or attributes them to guest, depending on the row type), so unmapped does not mean broken, just unattributed.

What you lose without a forum-import log

Even with a fully-populated xf_mc_dm_ic5_user_map, two cross-system mappings can only come from a real forum-import log:

  • IC5 topic → XF thread linking. The "Map discussion threads" flag has no effect without a topic-ID map; imported downloads will have no linked discussion thread.
  • IC5 attachment → XF attachment carry-over. Description and review attachments that came across with a prior forum import would have been remapped automatically; without a log, attachment markers in IC5 file descriptions/reviews stay as raw IC5 IDs and will not resolve to live XF attachments.

If neither of those matters for your library, the user map alone is sufficient.

Step configuration

The configuration screen lists every IC5 category and custom field with a map/create/skip choice. Flags:

FlagDefaultEffect
Import non-visible downloadsoffWhen off, only visible IC5 files are imported.
Map discussion threadsonWhen on, IC5 file → topic links are preserved by remapping IC5 topic IDs through the forum-import log to XF thread IDs (when a forum-import log was provided).
Import reviewsonWhen on, IC5 reviews migrate to xf_mc_dm_review.
Import followsonWhen on, IC5 file follows migrate to xf_mc_dm_download_watch.
Import tagsonWhen on, IC5 tag rows migrate to xf_tag_content.

Step list

#StepSource tableNotes
1categoriesdownloads_categoriesWalked by cparent so parents are inserted first. Titles read from core_sys_lang_words keyed downloads_category_<id>.
2fieldsdownloads_cfieldsCustom field definitions. Titles read from downloads_field_<id> language words. Field type is mapped to the closest DM equivalent.
3downloadsdownloads_filesEach IC5 file becomes a DM download. Author is resolved via the user-mapping chain. Optionally remaps the IC5 topic ID to an XF thread ID via the forum-import log.
4versionsderived from downloads_filebackup + the current file rowOlder versions reconstructed from IC5's backup table; the current file becomes the newest version.
5binariesdownloads_files_records (record_type='upload')Path is resolved as {files_path}/{record_location}. Missing files are logged and skipped. The binary is streamed to a temp file, sha256-hashed, and stored via MC\DownloadsManager\Util\Storage::store.
6urlFilesdownloads_files_records (record_type='link')IC5 external-URL "files" are imported as URL-type DM files.
7screenshotsdownloads_files_records (record_type='ssupload')Screenshot images are pushed through Service\Download\Icon so DM's variant set is generated.
8fieldValuesdownloads_ccontentPer-download custom-field values, remapped through the field-ID map.
9reviewsdownloads_reviewsMigrated to xf_mc_dm_review.
10followscore_follow where follow_app='downloads'Migrated to xf_mc_dm_download_watch.
11tagscore_tags where tag_meta_app='downloads'Migrated to xf_tag_content with content_type='mc_dm_download'.

IC5 has no concept of prefix groups or prefixes, so those steps are not present.

Notes and caveats

  • External DB only — the IC5 DB must be reachable from the XF host. The importer never writes back to it.
  • Files live on disk — the importer reads the IC5 uploads/ tree from the local filesystem. NFS / shared mounts are fine as long as the XF PHP process can read them. The IC5 record_location value already includes the monthly_YYYY_MM/originalname.HASH.ext segment, so do not concatenate any extra path segments yourself.
  • User mapping is mandatory — at minimum one entry in xf_mc_dm_ic5_user_map or one row in the forum-import log. Downloads owned by an unmapped IC5 member fall through to user ID 0 (guest) and are skipped or attributed depending on row.
  • Thread linking is best-effort — if Map discussion threads is on but no forum-import log was provided, discussion-thread IDs are left null. Existing XF threads can be linked manually post-import.
  • Schema fingerprint — if you point the importer at a non-IC5 schema (e.g. an IC4 dump), the downloads_files table check will fail with a clear error rather than corrupting data.