Live for Craft CMS

Console commands

live/snapshots/rebuild

Rewrites a post's static files from the database.

php craft live/snapshots/rebuild 123            # one entry's feed
php craft live/snapshots/rebuild --all          # every post
php craft live/snapshots/rebuild --all --siteId=2

The argument is the entry ID. Pass --all instead to rebuild every post, and --siteId to limit either form to one site.

Run it after:

  • changing live/_update.twig or the Update template setting — published updates keep the markup they were rendered with until something rewrites them
  • moving snapshotPath or snapshotUrl
  • restoring or redeploying a web root that doesn't keep web/live-feed/
  • fixing whatever made a snapshot write fail

The database is the record and the files are a cache of it, so a rebuild is always safe. It exits with a configuration error if snapshots are turned off.

live/snapshots/collect-garbage

php craft live/snapshots/collect-garbage

Two jobs in one pass:

  • brings every post's files in line with its entry's status — written for entries that have gone live on a schedule, removed for ones that have expired, since neither change saves anything in Craft
  • deletes snapshot directories whose post no longer exists

Craft's own garbage collection runs the same thing, but only occasionally. If you schedule or expire live-blogged entries, put this on a cron:

*/5 * * * * php /path/to/craft live/snapshots/collect-garbage

live/scheduled/release (Pro)

php craft live/scheduled/release
php craft live/scheduled/release --siteId=2

Puts any update whose time has come onto the site. A scheduled update is already in the database with its sequence number, so this only writes its snapshot — running it every minute costs nothing when nothing is due.

Nothing else releases scheduled updates. If you use them, it needs a cron:

* * * * * php /path/to/craft live/scheduled/release

On Lite the command says so and exits without doing anything.

More in Editorial

Pairs well with Live

For the people writing the content. Scheduling, staging, revision diffs, house style, find and replace, and a warning before two editors overwrite each other.