Skip to main content

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]
OptionDescription
--dry-runReport counts without modifying rows
--since=DATEOverride 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 have actor_ip_hash zeroed 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]
OptionDescription
--dry-runReport 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:

  1. Orphan filesxf_mc_dm_file rows whose version_id no longer points at a live xf_mc_dm_version row. The blob in internal-data://mc-downloads/ is removed alongside the row.
  2. Orphan versionsxf_mc_dm_version rows whose download_id no longer points at a live xf_mc_dm_download row.
  3. Orphan audit log targetsxf_mc_dm_audit_log rows pointing at a deleted target.
php cmd.php mc-dm:cleanup-orphans [--dry-run]
OptionDescription
--dry-runReport 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.