Maintenance commands
Three commands handle periodic data hygiene. Each has a cron counterpart that runs on the schedule set in AdminCP → Tools → Cron entries, plus a --dry-run flag for previewing impact without touching data.
mc-dm:purge-history
Prunes audit log rows older than the configured retention window and anonymizes the IP hash on rows older than the IP-anonymization window.
php cmd.php mc-dm:purge-history [--dry-run] [--since=DATE]
| Option | Description |
|---|---|
--dry-run | Report counts without modifying rows |
--since=DATE | Override the prune cutoff with a parseable date (e.g. 2026-01-01). Otherwise the cutoff is now − mcDownloadsManager_auditLogRetentionDays |
Two retention windows apply, controlled separately:
mcDownloadsManager_auditLogRetentionDays— rows older than this are deleted.mcDownloadsManager_auditLogIpRetentionDays— rows older than this haveactor_ip_hashzeroed but the row itself is preserved for audit continuity.
Sample output:
Pruned 142 audit log rows.
Anonymized IP hash on 87 rows.
With --dry-run the verbs change to Would prune / Would anonymize and no writes happen.
mc-dm:purge-tokens
Hard-deletes expired and revoked share tokens from xf_mc_dm_share_token. There is no soft-delete recovery for tokens — once a token is expired or revoked it has no further use.
php cmd.php mc-dm:purge-tokens [--dry-run]
| Option | Description |
|---|---|
--dry-run | Report count without deleting |
A token is eligible for purge when either expires_at < now() or revoked_at IS NOT NULL.
mc-dm:cleanup-orphans
Sweeps three classes of orphan rows that can accumulate after partial deletes, failed imports, or direct DB manipulation:
- Orphan files —
xf_mc_dm_filerows whoseversion_idno longer points at a livexf_mc_dm_versionrow. The blob ininternal-data://mc-downloads/is removed alongside the row. - Orphan versions —
xf_mc_dm_versionrows whosedownload_idno longer points at a livexf_mc_dm_downloadrow. - Orphan audit log targets —
xf_mc_dm_audit_logrows pointing at a deleted target.
php cmd.php mc-dm:cleanup-orphans [--dry-run]
| Option | Description |
|---|---|
--dry-run | Report counts without deleting |
This command does not clean up content that was correctly soft-deleted and is still inside the 30-day recovery window. Soft-deleted downloads are reaped by the mcDownloadsManagerHardDeleteOldRecords cron once retention expires.