1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-17 17:57:23 +01:00
This commit is contained in:
KiekerJan
2025-03-03 19:41:12 +01:00
committed by GitHub
9 changed files with 82 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ from datetime import date
import rtyaml
from exclusiveprocess import Lock
from utils import load_environment, shell, wait_for_service
from utils import load_environment, shell, wait_for_service, get_php_version
def backup_status(env):
# If backups are disabled, return no status.
@@ -266,6 +266,7 @@ def get_target_type(config):
def perform_backup(full_backup):
env = load_environment()
php_fpm = f"php{get_php_version()}-fpm"
# Create an global exclusive lock so that the backup script
# cannot be run more than one.
@@ -301,7 +302,7 @@ def perform_backup(full_backup):
if quit:
sys.exit(code)
service_command("php8.0-fpm", "stop", quit=True)
service_command(php_fpm, "stop", quit=True)
service_command("postfix", "stop", quit=True)
service_command("dovecot", "stop", quit=True)
service_command("postgrey", "stop", quit=True)
@@ -339,7 +340,7 @@ def perform_backup(full_backup):
service_command("postgrey", "start", quit=False)
service_command("dovecot", "start", quit=False)
service_command("postfix", "start", quit=False)
service_command("php8.0-fpm", "start", quit=False)
service_command(php_fpm, "start", quit=False)
# Remove old backups. This deletes all backup data no longer needed
# from more than 3 days ago.

View File

@@ -179,6 +179,11 @@ def wait_for_service(port, public, env, timeout):
return False
time.sleep(min(timeout/4, 1))
def get_php_version():
# Gets the version of PHP used by Mail-in-a-Box
# To modify PHP version, also update variable PHP_VER in functions.sh
return "8.1"
def get_ssh_port():
port_value = get_ssh_config_value("port")

View File

@@ -7,7 +7,7 @@ import os.path, re, rtyaml
from mailconfig import get_mail_domains
from dns_update import get_custom_dns_config, get_dns_zones
from ssl_certificates import get_ssl_certificates, get_domain_ssl_files, check_certificate
from utils import shell, safe_domain_name, sort_domains
from utils import shell, safe_domain_name, sort_domains, get_php_version
def get_web_domains(env, include_www_redirects=True, include_auto=True, exclude_dns_elsewhere=True):
# What domains should we serve HTTP(S) for?
@@ -82,6 +82,8 @@ def do_web_update(env):
# Build an nginx configuration file.
nginx_conf = read_conf("nginx-top.conf")
# Hardcode php version in the nginx configuration file
nginx_conf = re.sub("{{phpver}}", get_php_version(), nginx_conf)
# Load the templates.
template0 = read_conf("nginx.conf")