The command line
Media Organizer brings commands for Joomla's console. They are useful above all when a scan runs into a time limit in the browser, or when you want to script maintenance.
All commands run through Joomla's CLI entry point:
php cli/joomla.php jimgo:scan
The safety rule
Every command that changes something is a dry run by default. It shows what it would do, and does nothing.
It only executes with --confirm=<exact number> — you have to name the
number of files affected yourself and it has to be right. There is deliberately no
--yes, no --force and no --no-interaction for destructive
commands.
The reason: a typo or an outdated script must not delete something by accident. Whoever has to name the number has looked first.
Read-only commands
jimgo:scan
Runs a complete scan. Purely reading — never writes to the file system.
php cli/joomla.php jimgo:scan
This is the recommended route for large collections: no browser time limit, no clicking to continue. Ideal as a cron job alternative to the task scheduler as well.
jimgo:report
Writes the inventory to standard output.
php cli/joomla.php jimgo:report --format=csv --state=orphan_candidate > orphaned.csv
--format=json|csv | Output format. Default: json. |
--state=<state> | Only files in this state, orphan_candidate for example. |
jimgo:duplicates
Lists files with an identical checksum.
php cli/joomla.php jimgo:duplicates --limit=100
--limit=<n> | At most this many duplicate groups. Default: 50. |
jimgo:optimize
Reports files worth optimising according to the configured thresholds.
php cli/joomla.php jimgo:optimize --limit=100
--limit=<n> | At most this many files. Default: 50. |
Changing commands
jimgo:quarantine
Moves the unreferenced files of the last scan to quarantine.
# Dry run — only shows what would happen
php cli/joomla.php jimgo:quarantine
# Execute: the number given has to match exactly
php cli/joomla.php jimgo:quarantine --confirm=42
jimgo:purge
Deletes files in quarantine for good. The same twelve conditions apply as in the backend — the command line is not a back door.
php cli/joomla.php jimgo:purge
php cli/joomla.php jimgo:purge --confirm=17
jimgo:optimize:apply
Optimises the flagged images. Originals are backed up beforehand.
php cli/joomla.php jimgo:optimize:apply
php cli/joomla.php jimgo:optimize:apply --confirm=8
jimgo:profiles:update
Reloads the shipped extension profiles into the store. Useful after an update.
php cli/joomla.php jimgo:profiles:update
Overview
| Command | Effect | Needs --confirm |
|---|---|---|
jimgo:scan | reading | no |
jimgo:report | reading | no |
jimgo:duplicates | reading | no |
jimgo:optimize | reading | no |
jimgo:profiles:update | writes to the profile store only | no |
jimgo:quarantine | moves files | yes |
jimgo:optimize:apply | replaces images (with a backup) | yes |
jimgo:purge | deletes for good | yes |
A word on automation
You can put jimgo:scan into a cron job — that is sensible and
recommended.
Never put jimgo:purge --confirm=… into a cron job. The number would
have to be hard-wired there, and then the script deletes a different set of files on its next run
than the one you checked once. The --confirm rule is built precisely so that a human
looks.
Where to go from here
Applies to version 1.1.2.0.