Skip to main content

CLI commands

Administrative commands for inspecting and repairing chain state. Run from the XenForo root:

php cmd.php mc-threadsplit:<command> [arguments] [options]

All write commands prompt for confirmation. Pass --no-confirm to skip the prompt.

CommandTypePurpose
self-testDiagnosticRead-only health checks.
show-chainDiagnosticDump one chain's cached fields and parts.
cleanup-orphansMaintenanceDelete orphaned join rows and empty chains.
detachChain editRemove a thread from its chain.
dissolveChain editDelete a chain row, leaving its threads in place.
relinkChain editAttach an unchained thread to an existing chain.
renumberChain editRecompute part_number 1..N for a chain.
rebuild-config-cacheMaintenanceRebuild the per-forum config registry.
rebuild-chain-cacheMaintenanceRecompute one chain's cached fields.

Diagnostic

self-test

Read-only health checks for the install. Reports per-check status in a table.

php cmd.php mc-threadsplit:self-test

Exit codes: 0 all checks passed, 1 one or more failures, 2 warnings only.

show-chain

Diagnostic dump for a single chain: the chain row's cached fields, every part with its post count and watcher count, and aggregate totals.

php cmd.php mc-threadsplit:show-chain <chain_id>

Chain management

detach

Removes a thread from its chain. The chain's surviving parts are renumbered. If the detached thread was the only remaining member, the chain row is dissolved automatically.

php cmd.php mc-threadsplit:detach <thread_id> [--no-confirm]

The thread itself is not deleted, only its chain membership.

dissolve

Deletes a chain row entirely. All member threads remain in place but are no longer chained.

php cmd.php mc-threadsplit:dissolve <chain_id> [--no-confirm]

Use when an entire chain should be ungrouped without touching any individual thread.

Attaches an unchained thread to an existing chain. By default the thread is appended as the next part. Pass --position=N to insert at a specific part position (existing parts at or after that position shift down).

php cmd.php mc-threadsplit:relink <thread_id> <chain_id> [--position=N] [--no-confirm]

Fails if the thread is already a member of any chain.

renumber

Recomputes part_number 1..N for a chain, ordered by first_post_date. Safe to run any time; idempotent. Mainly useful after manual database edits or as a sanity sweep.

php cmd.php mc-threadsplit:renumber <chain_id>

Maintenance

cleanup-orphans

Finds and deletes:

  • chain_thread rows that point at threads which no longer exist (orphan join rows left over after a thread was hard-deleted), and
  • chain rows that have zero remaining members (empty chains).
php cmd.php mc-threadsplit:cleanup-orphans [--no-confirm]

Lists what will be removed and prompts before deleting. Run as part of routine maintenance, or after bulk thread deletion outside the normal moderation flow.

rebuild-config-cache

Rebuilds the per-forum enabled list and config registries from xf_mc_threadsplit_forum_config. Normally these are kept in sync automatically when a ForumConfig row is saved; run this if the registries are suspected of drift (for example after manual database edits or a failed install/upgrade).

php cmd.php mc-threadsplit:rebuild-config-cache

Reports the resulting enabled forum IDs and config row count. The same rebuild is also available from AdminCP > Tools > Rebuild caches > ThreadSplit: Rebuild forum cache.

rebuild-chain-cache

Recomputes the cached fields on a single chain row: parts_summary (the denormalised part list shown on the chain index), part_count, and total_post_count_cached. Idempotent.

php cmd.php mc-threadsplit:rebuild-chain-cache <chain_id>

Run when one chain's cached counts look wrong (for example after manual database edits or a failed split). To rebuild every chain at once, use AdminCP > Tools > Rebuild caches > ThreadSplit: Rebuild chain caches.

Operating playbook

When chain state looks wrong on a single chain:

  1. mc-threadsplit:show-chain <chain_id> — read what is currently there.
  2. mc-threadsplit:rebuild-chain-cache <chain_id> — fix denormalised counts if those are off.
  3. mc-threadsplit:renumber <chain_id> — if part numbers are out of order.
  4. If a part is in the wrong chain, mc-threadsplit:detach <thread_id> and then mc-threadsplit:relink <thread_id> <correct_chain_id>.

After bulk thread deletion outside the normal moderation flow:

  1. mc-threadsplit:cleanup-orphans.
  2. Confirm the pending state with mc-threadsplit:self-test.