Skip to content

refactor!: replace addon install/status flags with AddonState enum#6530

Merged
gharlan merged 2 commits into
6.xfrom
refactor/addon-state-enum
May 31, 2026
Merged

refactor!: replace addon install/status flags with AddonState enum#6530
gharlan merged 2 commits into
6.xfrom
refactor/addon-state-enum

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented May 31, 2026

Was

Ersetzt die getrennten install- und status-Properties eines Addons durch ein einziges typisiertes AddonState-Enum mit drei Zuständen: Uninstalled, Installed, Activated.

Bisher lagen Installations- und Aktivierungsstatus als generische Properties im selben Topf wie die addon-eigenen Werte aus package.yml — inklusive eines array_intersect_key-Hacks in loadProperties(), um sie beim Reload zu retten. Außerdem konnte die Kombination install=false / status=true zwar im Speicher kurz entstehen, war aber persistiert ohnehin unmöglich. Es gibt real nur drei Zustände — die bildet das Enum jetzt sauber ab.

Änderungen

  • Neues AddonState-Enum (string-backed) + typisierte Addon::$state-Property (public private(set)), gesetzt über @internal setState().
  • addons.json speichert state statt install/status. Keine Migration — bei bestehenden Dev-Installs schreibt console migrate/Sync das Format neu.
  • Addon::isAvailable()isActivated(), Addon::getAvailableAddons()getActivatedAddons(). Der Begriff „available" entfällt zugunsten von „activated".
  • Install-/Uninstall-Hooks brechen nur noch per throw new UserMessageException(...) ab; die alte installmsg-Property ist entfernt. successmsg bleibt für custom Erfolgsmeldungen.
  • Die Lifecycle-Methoden (install/uninstall/activate/deactivate) committen den neuen State nur noch im Erfolgsfall — kein Vorab-Setzen mit Rollback mehr. Ausnahme: schlägt das Uninstall nach erfolgreichem Deaktivieren fehl, wird der vorherige Zustand wiederhergestellt (inkl. Load-Order-Regenerierung).
  • Rector-Migrationsregeln für die umbenannten Methoden ergänzt.

Breaking Changes

  • Addon::isAvailable() und Addon::getAvailableAddons() umbenannt (Rector-Regeln vorhanden).
  • addons.json-Format geändert (install/statusstate).
  • installmsg-Property wird nicht mehr ausgewertet — Hooks müssen über UserMessageException abbrechen.

Replace the separate `install` and `status` properties with a single
`AddonState` enum (Uninstalled/Installed/Activated), stored as a typed
property instead of in the generic property bag. The three-state model
removes the impossible install=false/status=true combination.

- addons.json now stores `state` instead of `install`/`status` (no migration)
- rename Addon::isAvailable() -> isActivated() and getAvailableAddons() -> getActivatedAddons()
- install/uninstall hooks can only abort by throwing UserMessageException; drop the legacy installmsg property
- lifecycle methods commit the new state only on success
- add rector migration rules for the renamed methods
@gharlan gharlan added this to the REDAXO 6.0 milestone May 31, 2026
@gharlan gharlan merged commit 4b55f86 into 6.x May 31, 2026
16 checks passed
@gharlan gharlan deleted the refactor/addon-state-enum branch May 31, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants