Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions cli/Valet/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,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.
*
Expand Down
8 changes: 7 additions & 1 deletion cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down