mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 16:10:08 +01:00
Bring in changes to mirror #1358
This commit is contained in:
@@ -511,6 +511,27 @@ public function createCa(int $caExpireInDays): void
|
||||
$this->trustCa($caPemPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* If CA and root certificates exist, remove them.
|
||||
*/
|
||||
public function removeCa(): void
|
||||
{
|
||||
foreach (['pem', 'key', 'srl'] as $ending) {
|
||||
$path = $this->caPath('LaravelValetCASelfSigned.' . $ending);
|
||||
|
||||
if ($this->files->exists($path)) {
|
||||
$this->files->unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
$cName = 'Laravel Valet CA Self Signed CN';
|
||||
|
||||
$this->cli->run(sprintf(
|
||||
'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
|
||||
$cName
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and trust a certificate for the given URL.
|
||||
*
|
||||
|
||||
@@ -512,6 +512,8 @@ function (ConsoleCommandEvent $event) {
|
||||
|
||||
info('Removing certificates for all Secured sites...');
|
||||
Site::unsecureAll();
|
||||
info('Removing certificate authority...');
|
||||
Site::removeCa();
|
||||
info('Removing Nginx and configs...');
|
||||
Nginx::uninstall();
|
||||
info('Removing Dnsmasq and configs...');
|
||||
|
||||
@@ -778,6 +778,7 @@ public function test_force_uninstall_command()
|
||||
|
||||
$site = Mockery::mock(RealSite::class);
|
||||
$site->shouldReceive('unsecureAll')->once();
|
||||
$site->shouldReceive('removeCa')->once();
|
||||
$site->shouldReceive('uninstallLoopback')->once();
|
||||
|
||||
$nginx = Mockery::mock(Nginx::class);
|
||||
|
||||
Reference in New Issue
Block a user