Skip to content

refactor: restructure upgrade keys#37

Open
yCodeTech wants to merge 5 commits intomasterfrom
refactor/restructure-upgrade-keys
Open

refactor: restructure upgrade keys#37
yCodeTech wants to merge 5 commits intomasterfrom
refactor/restructure-upgrade-keys

Conversation

@yCodeTech
Copy link
Owner

No description provided.

- Added a new `Upgrader::isUpgraded` method to determine if the named upgrade has already been completed.

- Replaced the direct config access in the Upgrader methods `shouldUpgradeSymbolicLinks`  and `shouldUpgradeNginxSitePhpPortOverrides` to use the new `isUpgraded` method.

- Refactored `Configuration::updateKey` method to use Laravel's `Arr::set` method to set a value within an array instead of the direct array access. It enables usage of dot notation to easily access deeply nested array keys.
- Added a new `Upgrader::markAsUpgraded` method to mark an upgrade as completed, and add a key into Valet's config.

- Replaced the direct config `updateKey` in the Upgrader methods `upgradeSymbolicLinks`  and `upgradeNginxSitePhpPortOverrides` to use the new `markAsUpgraded` method.
@yCodeTech yCodeTech added the enhancement A quality of life enhancement label Mar 25, 2026
- Replaced the `shouldUpgradeNginxSitePhpPortOverrides` method call with a direct call to `isUpgraded` method for improved clarity and conciseness. The former method was only a light wrapper around `isUpgraded` method anyway.

- Removed the now unused `shouldUpgradeNginxSitePhpPortOverrides` method.
The new format allows for multiple one-time upgrade keys to be stored in an organised manner under the `upgrades` array. This stops valet's config from being polluted with many top-level `*_upgraded` config keys when new one-time upgrades are added in the future.

- Changed the `symlinks_upgraded` key to `symlinks`.

- Changed the `php_port_overrides_upgraded` key to `nginx_site_php_port_overrides`.

- Changed the config `get` and `updateKey` calls in `isUpgraded` and `markAsUpgraded` methods to use dot notation to get/update the specified upgrade key from the new top-level `upgrades`.
- Added `Upgrader::migrateSymlinksUpgradeKey` method to handle the transition from `symlinks_upgraded` to `symlinks`.

Note: The `symlinks_upgraded` is the only legacy key that needs to be migrated. The `php_port_overrides_upgraded` key wasn't released in a stable version, so it doesn't need migrating.

- Added `Configuration::removeKey` method to remove a specified key from the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A quality of life enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant