Add feature

Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
This commit is contained in:
Jean-Yves 2024-08-25 17:21:38 +02:00
parent 3ccdd332a9
commit f2e71532e7
No known key found for this signature in database
GPG key ID: 644C8B9C4CABAEF7
5 changed files with 28 additions and 11 deletions

View file

@ -71,7 +71,7 @@ class ConfigurationManager
if (!file_exists(DataConst::GetBackupArchivesList())) {
return '';
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === '') {
return '';
@ -91,7 +91,7 @@ class ConfigurationManager
if ($lastBackupTime === "") {
return '';
}
return $lastBackupTime;
}
@ -99,7 +99,7 @@ class ConfigurationManager
if (!file_exists(DataConst::GetBackupArchivesList())) {
return [];
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if ($content === '') {
return [];
@ -110,7 +110,7 @@ class ConfigurationManager
foreach($backupLines as $lines) {
if ($lines !== "") {
$backupTimesTemp = explode(',', $lines);
$backupTimes[] = $backupTimesTemp[1];
$backupTimes[] = $backupTimesTemp[1];
}
}
@ -140,7 +140,7 @@ class ConfigurationManager
if (!$this->isx64Platform()) {
return false;
}
$config = $this->GetConfig();
if (isset($config['isClamavEnabled']) && $config['isClamavEnabled'] === 1) {
return true;
@ -349,7 +349,7 @@ class ConfigurationManager
$testUrl = $protocol . $domain . ':443';
curl_setopt($ch, CURLOPT_URL, $testUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = (string)curl_exec($ch);
# Get rid of trailing \n
@ -455,7 +455,7 @@ class ConfigurationManager
if ($location === '') {
throw new InvalidSettingConfigurationException("Please enter a path!");
}
$isValidPath = false;
if (str_starts_with($location, '/') && !str_ends_with($location, '/')) {
$isValidPath = true;
@ -520,6 +520,10 @@ class ConfigurationManager
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
public function IsOverwriteEnable() : bool {
return getenv('DISABLE_OVERWRITE_URL') !== 'yes';
}
/**
* @throws InvalidSettingConfigurationException
*/
@ -698,7 +702,7 @@ class ConfigurationManager
if (!preg_match("#^[0-1][0-9]:[0-5][0-9]$#", $time) && !preg_match("#^2[0-3]:[0-5][0-9]$#", $time)) {
throw new InvalidSettingConfigurationException("You did not enter a correct time! One correct example is '04:00'!");
}
if ($enableAutomaticUpdates === false) {
$time .= PHP_EOL . 'automaticUpdatesAreNotEnabled';
} else {

View file

@ -297,6 +297,18 @@ class DockerActionManager
$replacements[1] = $this->configurationManager->GetApachePort();
} elseif ($out[1] === 'TALK_PORT') {
$replacements[1] = $this->configurationManager->GetTalkPort();
} elseif($out[1] === 'OVERWRITEHOST') {
if ($this->configurationManager->IsOverwriteEnable()) {
$replacements[1] = $this->configurationManager->GetDomain();
} else {
$replacements[1] = '';
}
} elseif($out[1] === 'OVERWRITEPROTOCOL') {
if ($this->configurationManager->IsOverwriteEnable()) {
$replacements[1] = 'https';
} else {
$replacements[1] = '';
}
} elseif ($out[1] === 'NEXTCLOUD_MOUNT') {
$replacements[1] = $this->configurationManager->GetNextcloudMount();
} elseif ($out[1] === 'BACKUP_RESTORE_PASSWORD') {