argument('domain'); foreach($domains as $domain) { $directories = [ 'archive' => self::CERT_DIR.'archive/'.$domain, 'live' => self::CERT_DIR.'live/'.$domain, 'renwal' => self::CERT_DIR.'renewal/'.$domain ]; $errors = 0; foreach($directories as $key => $directory) { if (!file_exists($directory)) { $errors++; } else { if ($key === 'renewal') { exec('rm '.$directory.'.conf 2>&1', $output); } else { exec('rm -rf '.$directory.' 2>&1', $output); } } } if ($errors === count($directories)) { $this->error('Error! Certificate for '.$domain.'...not found!'); } if ($errors > 0 && $errors < count($directories)) { $this->error('Trouble! Certificate for '.$domain.'...delete! Some files were not found!'); } if ($errors === 0) { $this->info('Success! Certificate for '.$domain.'...deleted!'); } } } }