1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 00:40:06 +01:00

Fix tld php errors from #241

Fixes #618 - PHP errors running TLD command if didn't run `valet install` as part of upgrading from version 2.0.12
This commit is contained in:
Chris Brown
2018-08-24 12:20:13 -04:00
parent 23e2eee8a1
commit f4281b4eaa
2 changed files with 11 additions and 4 deletions

View File

@@ -115,12 +115,15 @@ function writeBaseConfiguration()
}
/**
* For upgrades, change config key 'domain' to 'tld'
* Migrate old configurations from 'domain' to 'tld'
*/
$config = $this->read();
if (isset($config['domain']) && !isset($config['tld'])) {
$this->updateKey('tld', $config['domain']);
if (isset($config['tld'])) {
return;
}
$this->updateKey('tld', !empty($config['domain']) ? $config['domain'] : 'test');
}
/**

View File

@@ -59,6 +59,10 @@
* Get or set the TLD currently being used by Valet.
*/
$app->command('tld [tld]', function ($tld = null) {
if (empty(Configuration::read()['tld'])) {
Configuration::writeBaseConfiguration();
}
if ($tld === null) {
return info('Valet is configured to serve for TLD: .'.Configuration::read()['tld']);
}
@@ -74,7 +78,7 @@
Nginx::restart();
info('Your Valet TLD has been updated to ['.$tld.'].');
}, ['domain'])->descriptions('Get or set the TLD used for Valet sites. (Currently: .'.Configuration::read()['tld'].')');
}, ['domain'])->descriptions('Get or set the TLD used for Valet sites.');
/**
* Add the current working directory to the paths configuration.