Skip to main content

CLI commands

Downloads Manager ships six command-line entry points for operations work that does not belong in the AdminCP: scheduled maintenance under cron, on-demand counter recomputation after a manual data fix, and a scriptable health probe for monitoring.

All commands run through the cmd.php dispatcher and accept the standard global flags (-v, -q, --no-interaction).

php cmd.php <command> [options]

Substitute xf <command> if your install uses the xf wrapper.

Command index

CommandPurpose
mc-dm:health-checkRun 8 named probes and report pass / warn / fail per probe
mc-dm:purge-historyPrune audit log rows past retention and anonymize old IPs
mc-dm:purge-tokensHard-delete expired and revoked share tokens
mc-dm:cleanup-orphansHard-delete orphan files, versions, and audit log target rows
xf-rebuild:mc-dm-statsRecompute denormalized counters and refresh the statistics cache
xf-rebuild:mc-dm-integrityVerify SHA-256 of every stored file against the database row

Cron parity

The three mc-dm:purge-* and mc-dm:cleanup-* commands are also wired as cron entries that run automatically on the schedule configured in AdminCP → Tools → Cron entries. The CLI versions exist for ad-hoc runs (data fixes, retention-policy changes, before-and-after testing) and accept --dry-run for previewing impact.

The two xf-rebuild:* commands are not cron-driven. Run them manually after a data import, a hash-algorithm migration, or whenever denormalized counters drift.

Exit codes

Every command returns 0 on success. Non-zero exit indicates either a fatal error during execution or, for mc-dm:health-check, that at least one probe reported fail. Wire the health-check exit code into your monitoring system to alert on degraded state — see Health check for details.