This commit is contained in:
Bozhidar 2024-04-29 11:45:47 +03:00
parent fc22ab52b2
commit 54ef686de6
2 changed files with 9 additions and 5 deletions

View file

@ -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');
}
}
}

View file

@ -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');
}
}