MyStudio ships a command-line tool for developers and deployments: list, sync and validate themes, create child themes, override and revert files, switch modules, check the licence and the forum's health, and print server rules. Every command can answer in JSON for scripts and CI pipelines.
In short
php inc/plugins/mystudio/tools/cli.php <command>, command line only- Theme commands (sync, validate, override …) and deployment commands (activate, upgrade, health …)
- Add
--jsonfor scripts and CI
Running it
php inc/plugins/mystudio/tools/cli.php <command> [arguments] [--json]
Run it from the forum's root folder, as the user that owns the forum's files. It only runs from the command line, never from a browser. Exit codes: 0 on success, 1 on an error, 2 on wrong usage. With --json, every command prints one object: {"ok": true, …} or {"ok": false, "error": "…"}.
Theme commands
| Command | Does |
|---|---|
themes | Lists themes on disk with their parent, sync state and the active theme |
chain <slug> | The inheritance chain, the theme first |
create-child <parent> <name> [--slug=folder] | Creates and syncs a child theme |
files <slug> [--inherited|--overridden|--own] | Every file the theme uses and where it comes from |
override <slug> <path> | Copies an inherited file into the child theme, then syncs |
revert <slug> <path> | Deletes the child's copy so the parent's is used, then syncs |
sync <slug> | Files → database; child themes are synced too |
validate <slug> | Checks the chain, the stylesheet list, the templates and the sync state |
Deployment commands
| Command | Does |
|---|---|
activate | Activates the MyStudio plugin (a new forum, or after an upload) |
upgrade | Runs the upgrade steps of a newly uploaded version and re-syncs the shipped themes |
health | Checks that MyStudio, its themes and modules are in order |
modules [--on=a,b] [--off=c] | Lists modules or switches them on and off |
licence [--activate[=KEY]] [--reset] | Shows or refreshes the licence state, or activates a key (also from the MYSTUDIO_KEY environment variable) |
routes-nginx, routes-apache | Prints the SEO module's server rules for every permalink type, to include in your server configuration |
Examples
# a child theme with your own header, validated
php inc/plugins/mystudio/tools/cli.php create-child mystudio-default "My Forum Look"
php inc/plugins/mystudio/tools/cli.php override my-forum-look templates/header/header.html
php inc/plugins/mystudio/tools/cli.php sync my-forum-look
php inc/plugins/mystudio/tools/cli.php validate my-forum-look --json
# after deploying new files
php inc/plugins/mystudio/tools/cli.php upgrade
php inc/plugins/mystudio/tools/cli.php health --json
# switch on the modules a site needs
php inc/plugins/mystudio/tools/cli.php modules --on=ms-options,ms-editor-extras,ms-seo
# nginx: write the permalink rules into an include file
php inc/plugins/mystudio/tools/cli.php routes-nginx > /etc/nginx/snippets/forum-routes.conf
Syncing from your own scripts
Without the CLI, PHP can sync a theme directly:
php -r "define('IN_MYBB',1); require 'inc/init.php'; require MYBB_ROOT.'inc/plugins/mystudio/core.php'; (new MyStudio)->syncToDatabase('my-theme');"
Use it in CI
- Run
validate --jsonon every theme in your pipeline and fail whenokis false. - After deploying, run
upgradethenhealth. - Keep the licence key in a protected CI variable and pass it as
MYSTUDIO_KEYtolicence --activate.