argument('domain'); $all = $this->option('all'); if (!$domain && !$all) { $this->error('Please specify a domain or use --all flag'); return 1; } $query = HostedSite::query()->where('ssl_enabled', true); if ($domain) { $query->where('domain', $domain); } $sites = $query->get(); if ($sites->isEmpty()) { $this->warn('No sites found matching criteria'); return 0; } $this->info("Found {$sites->count()} site(s) to repair"); foreach ($sites as $site) { $this->line("Processing {$site->domain}..."); try { // Re-request SSL certificate (certbot will reuse existing cert if valid) $nodeProvider->requestLetsEncryptCertificate($site); $this->info(" ✓ SSL repaired for {$site->domain}"); } catch (\Exception $e) { $this->error(" ✗ Failed for {$site->domain}: " . $e->getMessage()); } } $this->newLine(); $this->info('Done!'); return 0; } }