# `MishkaCmsCore.PluginRegistrations`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/plugin_registrations.ex#L5)

Keeps every stored plugin registration on the event its module declares.

mishka_installer keeps registrations in Mnesia, on disk, and a plugin that registers again takes
its priority, dependencies and extra data from its code but keeps the EVENT it was first stored
under. So correcting the event a plugin declares changes nothing on an install that has already
run it: the registration still names the old event, the plugin is compiled into that event's chain
and no other, and whatever fires the corrected event never reaches it.

`reconcile/1` moves each such registration to the declared event and rebuilds both chains. The
stored status is kept, so a plugin an operator stopped stays stopped. A registration whose module
is not loaded, or declares no event, is left where it is: there is nothing to compare it with.

Attached once on boot via `attach/0` (from `MishkaCmsCore.Application.start/2`); it runs each time
mishka_installer finishes synchronizing its plugins, and at once if that has already happened.

# `attach`

```elixir
@spec attach() :: :ok
```

Attach the reconcile to mishka_installer's synchronized telemetry. Idempotent.

# `reconcile`

```elixir
@spec reconcile(boolean()) :: [module()]
```

Moves every registration stored under an event its module no longer declares, and returns the
plugins it moved.

`queue` is mishka_installer's own: `true` queues the chain rebuilds, `false` finishes them before
returning.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
