|
|
- <?php
-
- namespace App\Commands;
-
- use Illuminate\Console\Scheduling\Schedule;
- use LaravelZero\Framework\Commands\Command;
-
- /**
- *
- *
- *
- */
- class LetsEncryptRemoveCommand extends Command
- {
- const CERT_DIR = '/etc/certbot/';
-
- /**
- * The signature of the command.
- *
- * @var string
- */
- protected $signature = 'lets-encrypt:remove {domain*}';
-
- /**
- * The description of the command.
- *
- * @var string
- */
- protected $description = 'Remove Certificates from LetsEncrypt';
-
- /**
- * Execute the console command.
- *
- * @return mixed
- *
- */
- public function handle()
- {
- $domains = $this->argument('domain');
-
- foreach($domains as $domain) {
-
- $archive = self::CERT_DIR.'archive/'.$domain;
- $live = self::CERT_DIR.'live/'.$domain;
- $renewal = self::CERT_DIR.'renewal/'.$domain;
-
- rmdir($archiv);
- rmdir($live);
- rmdir($renewal);
-
- if (file_exists($archiv) && file_exists($live) && file_exists($renewal)) {
- $this->info('Certifikate for '.$domain.' ...deleted!');
- } else {
- $this->error('Certifikate for '.$domain.' ...not deleted!');
- }
- }
- }
- }
|