PortIgniter LMS includes a few maintenance commands. Run them inside the php container, for example:
docker compose exec php php spark system:info
Paths given to these commands are inside the container, where the data volume is mounted at /var/www/html/writable. Use absolute paths, and copy files in and out with docker compose cp.
Backups
lms:backup
php spark lms:backup [--output <folder|file.zip>] [--keep N] [--database-only] [--if-due] [--list]
Backs up the database and all uploaded and course files into one zip, named like lms-backup-20261101-030000.zip. By default, it writes to /var/www/html/writable/backups.
| Option | What it does |
|---|---|
--output |
A folder, where a dated file name is chosen, or a full .zip path. |
--keep N |
Afterwards, keep only the newest N backups in that folder. |
--database-only |
Leave out the files. |
--if-due |
Only make a backup if daily backups are on and today’s is missing. The scheduler uses this. |
--list |
List existing backups instead of making one. |
lms:restore
php spark lms:restore <backup.zip> [--check] [--force] [--database-only | --files-only]
Restores a backup made by lms:backup, replacing all current data. It asks you to type RESTORE unless you pass --force.
| Option | What it does |
|---|---|
--check |
Only check the backup and show what it contains. |
--force |
Don’t ask for confirmation. |
--database-only |
Restore only the database. |
--files-only |
Restore only the files. |
See Backups & Upgrades for the full procedure.
Courses
courses:check
php spark courses:check <archive.zip|folder> [--json]
Validates a course zip or folder exactly as Publish would, without importing it. It prints every problem and a summary, and exits with an error code on failure. Use an absolute path. See Course Files.
courses:reindex
php spark courses:reindex [course-id]
Rebuilds the database index of courses from the course files. Course files are the source of truth, so run this after restoring or moving course folders by hand. Leave out the course ID to reindex every course.
Restore a deleted course
Deleting a course moves its folder to /var/www/html/writable/courses-deleted/<id>-<timestamp>/. To bring it back, move it home and reindex it:
docker compose exec php mv /var/www/html/writable/courses-deleted/<id>-<timestamp> /var/www/html/writable/courses/<id>
docker compose exec php php spark courses:reindex <id>
The course ID must not have been reused by a new course in the meantime.
The course returns as a fresh course. Its old enrollments and progress stay with the deleted record and don’t come back with it.
Accounts
lms:ensure-admin
php spark lms:ensure-admin [--email <email>] [--password <password>] [--name <name>]
Creates an administrator from lms.adminEmail and lms.adminPassword if no active administrator exists. This runs automatically every time the php container starts. If every administrator account has been lost or deactivated, set those two values in .env and restart, or run this command.
Prefer the .env settings to --password: command-line arguments are visible in process lists.
Quizzes
quiz:finalize-expired
php spark quiz:finalize-expired
Submits timed quiz attempts whose deadline has passed, using the answers saved so far. The scheduler runs this every 2 minutes, so you never need to run it by hand.
Diagnostics
system:info
php spark system:info [--json]
Prints the PortIgniter LMS version and build date, PHP version and settings, operating system details, the database connection status, and disk usage. Passwords are never printed. Include this output when you report a bug.
Container roles
The php and scheduler services use the same PortIgniter LMS image:
| Service | What it does |
|---|---|
php |
Serves the application. On startup, it applies database updates, creates the first administrator if needed, and publishes static files for nginx. |
scheduler |
Every 2 minutes, finishes expired timed quizzes and makes the daily backup when one is due. It never applies database updates. |
Only php applies database updates, so upgrading is as simple as changing LMS_TAG and running docker compose up -d.