fix domain suspension

This commit is contained in:
Bozhidar 2024-05-12 22:33:24 +03:00
parent 1f0ecd1011
commit 0bb29e50cd
3 changed files with 55 additions and 42 deletions

View file

@ -260,9 +260,6 @@ class Domain extends Model
$apacheVirtualHostBuilder->setHomeRoot($this->home_root);
$apacheVirtualHostBuilder->setUser($findHostingSubscription->system_username);
$apacheVirtualHostBuilder->setUserGroup($webUserGroup);
$apacheVirtualHostBuilder->setAdditionalServices($findHostingPlan->additional_services);
$apacheVirtualHostBuilder->setAppType($appType);
$apacheVirtualHostBuilder->setAppVersion($appVersion);
if ($this->status == self::STATUS_SUSPENDED) {
$suspendedPath = '/var/www/html/suspended';
@ -275,9 +272,7 @@ class Domain extends Model
}
$apacheVirtualHostBuilder->setDomainRoot($suspendedPath);
$apacheVirtualHostBuilder->setDomainPublic($suspendedPath);
}
if ($this->status == self::STATUS_DEACTIVATED) {
} else if ($this->status == self::STATUS_DEACTIVATED) {
$deactivatedPath = '/var/www/html/deactivated';
if (!is_dir($deactivatedPath)) {
mkdir($deactivatedPath, 0755, true);
@ -288,7 +283,12 @@ class Domain extends Model
}
$apacheVirtualHostBuilder->setDomainRoot($deactivatedPath);
$apacheVirtualHostBuilder->setDomainPublic($deactivatedPath);
}
} else {
$apacheVirtualHostBuilder->setEnableLogs(true);
$apacheVirtualHostBuilder->setAdditionalServices($findHostingPlan->additional_services);
$apacheVirtualHostBuilder->setAppType($appType);
$apacheVirtualHostBuilder->setAppVersion($appVersion);
if ($this->server_application_type == 'apache_nodejs') {
$apacheVirtualHostBuilder->setAppType('nodejs');
@ -332,6 +332,7 @@ class Domain extends Model
}
}
}
}
$apacheBaseConfig = $apacheVirtualHostBuilder->buildConfig();

View file

@ -37,6 +37,8 @@ class ApacheVirtualHostBuilder
public $proxyPass = null;
public $enableLogs = false;
public function setPort($port)
{
$this->port = $port;
@ -131,6 +133,11 @@ class ApacheVirtualHostBuilder
$this->proxyPass = $proxyPass;
}
public function enableLogs($enableLogs)
{
$this->enableLogs = $enableLogs;
}
public function buildConfig()
{
$settings = [
@ -153,6 +160,7 @@ class ApacheVirtualHostBuilder
'passengerAppType' => $this->passengerAppType,
'passengerStartupFile' => $this->passengerStartupFile,
'proxyPass' => $this->proxyPass,
'enableLogs' => $this->enableLogs,
];
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);

View file

@ -31,12 +31,16 @@
@endif
@if($enableLogs)
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog {{$domainRoot}}/logs/apache2/bytes.log bytes
CustomLog {{$domainRoot}}/logs/apache2/access.log common
ErrorLog {{$domainRoot}}/logs/apache2/error.log
@endif
@if($appType == 'php')
ScriptAlias /cgi-bin/ {{$domainPublic}}/cgi-bin/