refactor!: replace addon install/status flags with AddonState enum#6530
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was
Ersetzt die getrennten
install- undstatus-Properties eines Addons durch ein einziges typisiertesAddonState-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 einesarray_intersect_key-Hacks inloadProperties(), um sie beim Reload zu retten. Außerdem konnte die Kombinationinstall=false / status=truezwar 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
AddonState-Enum (string-backed) + typisierteAddon::$state-Property (public private(set)), gesetzt über@internal setState().addons.jsonspeichertstatestattinstall/status. Keine Migration — bei bestehenden Dev-Installs schreibtconsole migrate/Sync das Format neu.Addon::isAvailable()→isActivated(),Addon::getAvailableAddons()→getActivatedAddons(). Der Begriff „available" entfällt zugunsten von „activated".throw new UserMessageException(...)ab; die alteinstallmsg-Property ist entfernt.successmsgbleibt für custom Erfolgsmeldungen.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).Breaking Changes
Addon::isAvailable()undAddon::getAvailableAddons()umbenannt (Rector-Regeln vorhanden).addons.json-Format geändert (install/status→state).installmsg-Property wird nicht mehr ausgewertet — Hooks müssen überUserMessageExceptionabbrechen.