Files
RenewCMS/docs/releases/v2.9.0-beta.md
T

3.1 KiB

This release adds a duplicate purge to the media library: owners and admins can merge identical images in one action, or let RenewCMS do it on a schedule.

New

Media duplicate purge

  • Purge duplicates from the Duplicates tab of the media library with the new toolbar button, or from the new Media cleanup card in Settings. A summary shows how many copies would be merged and how many articles would be updated before you confirm.
  • For each group of identical images used in at least one article, the most used copy is kept, with ties going to the oldest. Every other copy is merged into it and the articles that used them are rewritten. Groups where no copy is used are left alone.
  • If the library changes between the summary and the confirmation, nothing is purged and you are asked to check the new summary.
  • Turn on automatic purge in Settings and choose an interval from 1 to 365 days, 30 by default. The first run happens one interval after you turn it on, then once per interval after each run.
  • The Media cleanup card shows the last run, with the number of copies merged and articles updated, and the date of the next one.
  • The purge is reserved for owners and admins. Editors get a clear message instead of the controls.
  • The new screens are available in English and French.

API

  • GET /v1/media/purge-settings returns the automatic purge settings: auto_purge_enabled, auto_purge_interval_days, last_purge_at, last_purge_merged, last_purge_articles_updated and next_purge_at, which is null while automatic purge is off.
  • PATCH /v1/media/purge-settings updates auto_purge_enabled and auto_purge_interval_days. An interval outside 1 to 365 answers 400.
  • GET /v1/media/purge-preview returns what a purge would do, with a fingerprint of the plan. It changes nothing.
  • POST /v1/media/purge runs the purge. Send the preview's fingerprint to refuse a run if the library changed: a stale fingerprint answers 409, and so does a purge that is already running.
  • All four routes answer 403 with "Only owners and admins can do this." for any other role, and accept a session only, like the rest of the media routes.

Under the hood

  • Add the purge domain, a SQLite repository for the single-row purge settings, and the use cases that build the plan, preview it, run it and decide when a scheduled run is due.
  • Add an hourly scheduler, started with the server after a one-minute delay and stopped on shutdown. It reads the settings on every tick, so changes apply without a restart, and a failed run is retried at the next tick.
  • Add the RequireOwnerOrAdmin middleware.
  • Add the media purge, scheduler and Settings card specifications and QA procedures to features/, the new screens to docs/design/, and Go and Vitest suites for each part.

Upgrading

  • Replace the binary, or pull the new image. The purge settings table is created automatically at startup. No new environment variable is required.
  • Automatic purge is off after the upgrade. Nothing is merged until an owner or admin runs a purge or turns it on.
  • A purge cannot be undone: merged copies are removed. Check the summary before confirming.