Mux Plugin Console Commands Documentation
This document provides comprehensive documentation for all available console commands in the Mux plugin for Craft CMS.
Overview
The Mux plugin provides several console commands to help manage Mux assets, cache, and synchronization. All commands are prefixed with php craft mux/ and can be run from your Craft project's root directory.
Available Commands
1. Assign Commands (mux/assign)
The assign commands help you manage volume and folder assignments for MuxAsset elements.
mux/assign/assign
Assigns volumeId and folderId to MuxAsset elements that have null values.
Options:
| Option | Description |
|---|---|
--volumeId | The volume ID to assign to assets with null volumeId |
--folderId | The folder ID to assign to assets with null folderId |
--verbose | Show verbose output during processing |
--force | Force assignment without confirmation prompts |
--dryRun | Show what would be changed without making actual changes |
Aliases:
-vfor--volumeId-ffor--folderId-Vfor--verbose-Ffor--force-dfor--dryRun
Usage Examples:
# Assign volumeId 1 to all assets with null volumeId
php craft mux/assign/assign --volumeId=1
# Assign folderId 2 to all assets with null folderId
php craft mux/assign/assign --folderId=2
# Assign both volumeId 1 and folderId 2 to assets with null values
php craft mux/assign/assign --volumeId=1 --folderId=2
# Dry run to see what would be changed without making changes
php craft mux/assign/assign --volumeId=1 --folderId=2 --dryRun
# Force assignment without confirmation prompts
php craft mux/assign/assign --volumeId=1 --folderId=2 --force
# Show verbose output during processing
php craft mux/assign/assign --volumeId=1 --folderId=2 --verbosemux/assign/stats
Shows statistics about MuxAsset elements with null volumeId or folderId.
Usage Example:
php craft mux/assign/statsmux/assign/list
Lists all assets that have null volumeId or folderId.
Usage Example:
php craft mux/assign/listmux/assign/list-volumes-and-folders
Lists all volumes and folders with their ID and name.
Usage Example:
php craft mux/assign/list-volumes-and-folders2. Cache Commands (mux/cache)
The cache commands help you manage Mux data cache.
mux/cache/clear
Clears cache for a specific asset or all assets.
Options:
| Option | Description |
|---|---|
--assetId | The specific asset ID to clear cache for (optional) |
--verbose | Show verbose output during processing |
--force | Force cache clearing without confirmation |
Aliases:
-afor--assetId-vfor--verbose-ffor--force
Usage Examples:
# Clear cache for all assets
php craft mux/cache/clear
# Clear cache for a specific asset
php craft mux/cache/clear --assetId=abc123
# Clear cache for all assets with verbose output
php craft mux/cache/clear --verbose
# Force clear cache without confirmation
php craft mux/cache/clear --forcemux/cache/clear-all
Clears cache for all MUX assets.
Options:
| Option | Description |
|---|---|
--verbose | Show verbose output during processing |
--force | Force cache clearing without confirmation |
Aliases:
-vfor--verbose-ffor--force
Usage Example:
php craft mux/cache/clear-all --verbosemux/cache/clear-asset
Clears cache for a specific asset.
Options:
| Option | Description |
|---|---|
--assetId | The asset ID to clear cache for |
--verbose | Show verbose output during processing |
--force | Force cache clearing without confirmation |
Aliases:
-afor--assetId-vfor--verbose-ffor--force
Usage Example:
php craft mux/cache/clear-asset --assetId=abc123mux/cache/stats
Shows cache statistics for MUX-related cache entries.
Options:
| Option | Description |
|---|---|
--verbose | Show verbose output with detailed asset information |
Aliases:
-vfor--verbose
Usage Example:
php craft mux/cache/stats --verbose3. Sync Commands (mux/sync)
The sync commands help you synchronize Mux assets.
mux/sync/all
Syncs all MUX assets.
Usage Example:
php craft mux/sync/allGeneral Usage Notes
- All commands should be run from your Craft project's root directory
- Commands that modify data will ask for confirmation unless the
--forceflag is used - Use
--verboseflag to get detailed output about what the command is doing - Use
--dryRunflag (where available) to preview changes without actually making them - Commands return appropriate exit codes for scripting purposes
Error Handling
- Commands will display error messages in red for easy identification
- Success messages are displayed in green
- Warning messages are displayed in yellow
- Informational messages are displayed in cyan
Exit Codes
0(ExitCode::OK) - Command completed successfully1(ExitCode::DATAERR) - Data error (e.g., invalid parameters)2(ExitCode::UNSPECIFIED_ERROR) - Unspecified error occurred
This documentation covers all available console commands in the Mux plugin. For additional help with any specific command, you can use the --help flag with any command to see its specific usage information.