Command line
All scripts live in local/loop/cli/ and follow Moodle's conventions: run them as the web server user, from the Moodle root. Every script accepts --help.
Export the configuration
php local/loop/cli/export.php --output=/tmp/configuration.csv
php local/loop/cli/export.php --output=/tmp/configuration.csv --delimiter=semicolon| Option | Short | Default | Meaning |
|---|---|---|---|
--output | -o | standard output | File to write |
--delimiter | -d | comma | Field delimiter: comma, semicolon or tab |
Every edition is in the file, including the ones LOOP recognises from the courses themselves. It never needs a licence. Anything the export could not write is reported on standard error, so it survives the file being redirected into a pipe.
Import the configuration
php local/loop/cli/import.php --file=/tmp/configuration.csv --preview
php local/loop/cli/import.php --file=/tmp/configuration.csv --execute
php local/loop/cli/import.php --file=/tmp/configuration.csv --execute --allow-rename| Option | Short | Default | Meaning |
|---|---|---|---|
--file | -f | — | File to read |
--preview | -p | off | Print what the file would change, write nothing |
--execute | -e | off | Apply the file |
--delimiter | -d | auto | Force a delimiter instead of detecting one: comma, semicolon or tab |
--allow-rename | — | off | Let the file rename a certification whose stored name differs |
--preview prints the same sentences the import page shows, and it reflects the options it is run with: without --allow-rename, previewing a file that renames something reports the refusal that --execute would give.
What an import does not do: it never deletes a certification, and a certification row with no edition rows under it keeps the editions it has. One error refuses the whole file, before anything is written. See Import and export the configuration.
Export and import notification texts
php local/loop/cli/export_messages.php --output=texts.csv
php local/loop/cli/import_messages.php --file=texts.csv --preview
php local/loop/cli/import_messages.php --file=texts.csv --executeSame options as above, --allow-rename aside: it means nothing here. The file has one row per notice and language; its rules are in CSV format.
Recalculate stored dates
php local/loop/cli/recalculate.php --preview
php local/loop/cli/recalculate.php --execute
php local/loop/cli/recalculate.php --certification=7 --execute| Option | Short | Default | Meaning |
|---|---|---|---|
--preview | -p | off | Report what would change, write nothing |
--execute | -e | off | Apply the recalculation |
--certification | -c | every active certification | Restrict to one certification, active or not |
Repeatable: running it twice with nothing new in between leaves everything as it was. It is also how a site brings in completions recorded before LOOP was installed. See Recalculate stored dates.
Changes made this way appear in the site log (Site administration → Reports → Logs) with cli as their origin. Moodle records cron under the same origin, since both run without a browser.
Running a scheduled task by hand
Not a LOOP script, but the one you will reach for most. Use it to bring a status or a queue up to date without waiting for the night.
php admin/cli/scheduled_task.php --execute='\local_loop\task\<task>'| Task | Replace <task> with |
|---|---|
| Sync certification editions | sync_editions_task |
| Rebuild derived certification data | project_task |
| Check certification expiries | check_expiries_task |
| Check overdue certifications | check_overdue_task |
| Check expired certifications | check_expired_task |
| Send monthly manager compliance reports | send_manager_reports_task |
| Process LOOP mail queue | process_mail_queue_task |
| Validate LOOP license | validate_license_task |
| Purge anonymised audit rows past retention | purge_anonymized_audit_task |
For example:
php admin/cli/scheduled_task.php --execute='\local_loop\task\check_expiries_task'The same tasks can be run from Site administration → Server → Scheduled tasks, which is easier if you do not have shell access.