# evoRollback reference

> evoRollback reference: package parts, evoMCP tools, REST API and how to write an adapter for another extension.

## Package parts

| Part | What it does |
| --- | --- |
| `com_evorollback` | The core, the database store, the administration (versions, diffs, restore, undo and restore points) and the options. |
| `plg_system_evorollback` | Loads the adapters on every request so they listen to save events, and serves the licence field. |
| `plg_evorollback_joomla` | Joomla core adapter: articles, categories, modules, menu items, component options, template styles, field groups, workflows (with stages and transitions) and plugin parameters. |
| `plg_evomcp_evorollback` | evoMCP tools. |
| `plg_webservices_evorollback` | Read-only REST API. |
| `plg_privacy_evorollback` | Exports and unlinks the versions made by a person. |
| `plg_task_evorollback` | Daily purge according to retention. |

## evoMCP tools

They exist only if evoMCP is installed. An entity is written as `adapter:type:id`, for example `joomla:article:42`.

| Tool | Permission | Parameters | What it does |
| --- | --- | --- | --- |
| `rollback_adapters` | read | none | Lists which extensions are versioned and their entity types. |
| `rollback_history` | read | `entity` (required), `limit` (1 to 100, default 20) | Versions of an entity, newest first: id, date, reason (`save`, `baseline`, `restore`, `point`), who (`user`, `ai` or `system`), previous version and short hash. Without the data. |
| `rollback_diff` | read | `from` (required), `to` (optional) | Compares two versions of the same entity, or `from` with the current state if you omit `to`. Field by field (`path`, `before`, `after`); long values are cut at 400 characters. |
| `rollback_restore` | write, always needs human approval | `snapshot_id` (required), `dry_run` | Returns the entity to that version. With `dry_run` it only shows what would change. Returns the changes, the reserved fields that are kept, and the ids of the previous and new versions. |
| `rollback_undo` | write, always needs human approval | `snapshot_id` (the version created by `rollback_restore`), `dry_run` | Undoes a restore: restores the version that existed just before. |
| `rollback_create_point` | write | `label` (3 to 190 characters), `entities` (1 to 50), `dry_run` | Creates a restore point: fixes the current state of several entities at once. |

Recommended flow: `rollback_history`, `rollback_diff`, `rollback_restore` with `dry_run` and, if the result is as expected, `rollback_restore`. Approving a restore from evoMCP requires a Super User. Component options are read and changed with `options_get` and `options_set`.

## REST API (read-only)

- `GET /api/index.php/v1/evorollback/snapshots`, with filters `filter_adapter`, `filter_type` and `filter_entity_id` and pagination `page[limit]` and `page[offset]`.
- `GET /api/index.php/v1/evorollback/snapshots/:id`, with the changes against the previous version.

It requires `core.manage` on the component.

## Writing an adapter for another extension

An adapter is a plugin in the `evorollback` group that, on the `onEvorollbackCollectAdapters` event, registers a class implementing `AdapterInterface`:

- `key()` and `entityTypes()`: its identifier and its entity types.
- `read(EntityRef)`: the data, or `null` if it does not exist. `write(EntityRef, array)`: restores, always through the extension's models and never through SQL.
- `ignoredFields()`, `secretFields()` and `personalFields()`: dotted paths with wildcards (for example `params.*email*`) for what does not count as a change and what is never stored.
- `canRecreate()`: whether it can recreate a deleted entity.

The adapter starts the capture: it subscribes to its extension's save events, checks `CaptureGate::allowed()` and calls `Backend::recorder()->record($ref, 'save', …)`. The Joomla adapter, `plg_evorollback_joomla`, is a complete example.

---

https://evoaddons.com/en/documentation/evorollback-reference
