From 54ef686de60094e1771e14ee46f8d145eeb66342 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Mon, 29 Apr 2024 11:45:47 +0300 Subject: [PATCH] update --- web/app/Console/Commands/RunDomainRepair.php | 3 ++- web/app/Models/Domain.php | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/app/Console/Commands/RunDomainRepair.php b/web/app/Console/Commands/RunDomainRepair.php index c103ac6..95b87a0 100644 --- a/web/app/Console/Commands/RunDomainRepair.php +++ b/web/app/Console/Commands/RunDomainRepair.php @@ -30,8 +30,9 @@ class RunDomainRepair extends Command if ($getAllDomains->count() > 0) { foreach ($getAllDomains as $domain) { $this->info('Repair domain: ' . $domain->domain); - $domain->configureVirtualHost(); + $domain->configureVirtualHost(false); } + shell_exec('service apache2 restart'); } } } diff --git a/web/app/Models/Domain.php b/web/app/Models/Domain.php index ef26856..5077675 100644 --- a/web/app/Models/Domain.php +++ b/web/app/Models/Domain.php @@ -106,7 +106,7 @@ class Domain extends Model return $this->belongsTo(HostingSubscription::class); } - public function configureVirtualHost() + public function configureVirtualHost($reloadApache = true) { $findHostingSubscription = \App\Models\HostingSubscription::where('id', $this->hosting_subscription_id) ->first(); @@ -299,8 +299,9 @@ class Domain extends Model } // Reload apache - shell_exec('systemctl reload apache2'); - + if ($reloadApache) { + shell_exec('systemctl reload apache2'); + } $catchMainDomain = ''; $domainExp = explode('.', $this->domain); if (count($domainExp) > 0) { @@ -377,7 +378,9 @@ class Domain extends Model shell_exec('ln -s /etc/apache2/sites-available/'.$this->domain.'-ssl.conf /etc/apache2/sites-enabled/'.$this->domain.'-ssl.conf'); // Reload apache - shell_exec('systemctl reload apache2'); + if ($reloadApache) { + shell_exec('systemctl reload apache2'); + } }