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

Merge pull request #854 from drbyte/valet-unsecure-all

Add --all parameter to valet unsecure command
This commit is contained in:
Matt Stauffer
2019-12-01 14:55:43 -05:00
committed by GitHub
2 changed files with 38 additions and 1 deletions

View File

@@ -491,6 +491,37 @@ function unsecure($url)
));
}
function unsecureAll()
{
$tld = $this->config->read()['tld'];
$secured = $this->parked()
->merge($this->links())
->sort()
->where('secured', ' X');
if ($secured->count() === 0) {
return info('No sites to unsecure. You may list all servable sites or links by running <comment>valet parked</comment> or <comment>valet links</comment>.');
}
info('Attempting to unsecure the following sites:');
table(['Site', 'SSL', 'URL', 'Path'], $secured->toArray());
foreach ($secured->pluck('site') as $url) {
$this->unsecure($url . '.' . $tld);
}
$remaining = $this->parked()
->merge($this->links())
->sort()
->where('secured', ' X');
if ($remaining->count() > 0) {
warning('We were not succesful in unsecuring the following sites:');
table(['Site', 'SSL', 'URL', 'Path'], $remaining->toArray());
}
info('unsecure --all was successful.');
}
/**
* Get the path to the linked Valet sites.
*

View File

@@ -164,7 +164,13 @@
/**
* Stop serving the given domain over HTTPS and remove the trusted TLS certificate.
*/
$app->command('unsecure [domain]', function ($domain = null) {
$app->command('unsecure [domain] [--all]', function ($domain = null, $all) {
if ($all) {
Site::unsecureAll();
return;
}
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
Site::unsecure($url);