![]() |
VOOZH | about |
The Command-Line Interface (CLI) system provides administrative and maintenance functionality through the maho binary. Built on Symfony Console, it offers commands for cache management, indexing, user administration, database operations, and system maintenance. Commands can execute with or without bootstrapping the full Mage framework, depending on operational requirements.
For database schema migrations and setup, see Installation Command. For web-based administration, see Admin Interface. For cron job scheduling via CLI, see Cron System.
The maho script serves as the CLI entry point, loading the Symfony Console Application and registering all available commands. The bootstrap process establishes directory constants, loads Composer autoload, and discovers commands from multiple sources. All Maho-specific commands typically extend BaseMahoCommand which provides helper methods like initMaho() to initialize the application state by registering the secure area and initializing the admin app lib/MahoCLI/Commands/BaseMahoCommand.php20-24
The following diagram illustrates the transition from the maho entry point to the command execution logic.
Sources: maho1-107 lib/MahoCLI/Commands/BaseMahoCommand.php18-35 lib/MahoCLI/CommandDiscoverer.php17-79
For details, see CLI Architecture.
The maho install command provides a non-interactive way to set up the Maho platform. It handles database creation, administrative user setup, and initial configuration lib/MahoCLI/Commands/Install.php30-75 It supports multiple database engines including mysql, pgsql, and sqlite via the --db_engine option lib/MahoCLI/Commands/Install.php49 Additionally, it can download and import sample data, using SampleDataImporter to remap EAV attribute IDs to match the fresh installation lib/MahoCLI/Helper/SampleDataImporter.php25-227
| Operation | Command | File |
|---|---|---|
| Full Installation | maho install | maho70 |
| Database Migration | maho migrate | maho71 |
For details, see Installation Command.
Cache commands control Maho's multi-level caching system. These commands allow for flushing specific types or the entire cache storage to ensure configuration or data changes are reflected immediately.
| Command | Purpose | Implementation |
|---|---|---|
cache:flush | Flush all cache types | Registered in maho36 |
cache:enable | Enable all cache types | Registered in maho34 |
cache:disable | Disable all cache types | Registered in maho35 |
cache:minify:flush | Flush minified assets | Registered in maho37 |
For details, see Cache Management Commands.
Index commands manage Maho's indexing system, which maintains denormalized data structures for storefront performance. These commands interact with the indexer process models.
| Command | Purpose | Implementation |
|---|---|---|
index:list | List indexes and status | Registered in maho53 |
index:reindex | Reindex specific code | $index->reindexEverything() lib/MahoCLI/Commands/IndexReindex.php48 |
index:reindex:all | Reindex all | Registered in maho55 |
For details, see Index Management Commands.
Maho provides CLI utilities for managing both administrative backend users and storefront customers, utilizing their respective models for data persistence.
The diagram below maps CLI commands to their corresponding framework models.
Sources: maho28-43 lib/MahoCLI/Commands/AdminUserChangepassword.php53-61
For details, see User Management Commands.
Direct database interaction is supported through specialized commands that use Maho's resource connections.
| Command | Purpose | File |
|---|---|---|
db:connect | Open interactive DB shell | maho44 |
db:query | Execute raw SQL query | maho45 |
These commands utilize the underlying database adapters to interact with the configured storage engine.
For details, see Database Commands.
This category includes essential tools for site maintenance, cron execution, and developer productivity.
The cron:run command allows manual execution of scheduled tasks by group (default/always) or specific job code lib/MahoCLI/Commands/CronRun.php25-28 It supports locking to prevent concurrent execution of the same job lib/MahoCLI/Commands/CronRun.php95-98
| Command | Purpose | Implementation |
|---|---|---|
cron:list | List jobs from XML | Mage::helper('cron')->getConfiguredJobs() lib/MahoCLI/Commands/CronList.php36 |
cron:history | Show execution log | Registered in maho58 |
Maho includes commands to migrate legacy XML-based configurations to modern PHP attributes:
legacy:migrate-observers: Migrates <events> observer declarations to #[Maho\Config\Observer] attributes.legacy:migrate-cron: Migrates cron job declarations maho74legacy:migrate-routes: Migrates front controller route declarations maho75health-check: Scans the project for legacy core files, deprecated folders, and orphaned resource IDs.serve: Runs the built-in PHP web server maho77shell: Opens an interactive PHP shell (REPL) with Maho initialized maho78config:set/get/delete: Direct manipulation of core configuration data maho86-88log:status: Provides row counts and data sizes for logging tables such as log/visitor and log/customer lib/MahoCLI/Commands/LogStatus.php26-54sys:encryption-key-regenerate: Handles the rotation of system encryption keys maho82dev:module:list: Lists all installed modules maho95dev:lsp:start / dev:mcp:start: Starts Maho Intelligence servers for IDE and AI integration.For details, see Maintenance and Development Commands.
Sources: maho1-107 lib/MahoCLI/Commands/LogStatus.php23-86 lib/MahoCLI/Commands/CronList.php26-49 lib/MahoCLI/Commands/CronRun.php25-134
Refresh this wiki