mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-23 02:27:05 +00:00
Place the PHP version into a variable (#2307)
Also - trims a few trailing whitespace characters - gitignores VS code workspace
This commit is contained in:
parent
8e4e9add78
commit
2a0cd8bfd8
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ externals/
|
||||
.env
|
||||
.vagrant
|
||||
api/docs/api-docs.html
|
||||
*.code-workspace
|
||||
|
1309
CHANGELOG.md
1309
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,6 @@
|
||||
## your own --- please do not ask for help from us.
|
||||
|
||||
upstream php-fpm {
|
||||
server unix:/var/run/php/php8.0-fpm.sock;
|
||||
server unix:/var/run/php/php{{phpver}}-fpm.sock;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import dateutil.parser, dateutil.relativedelta, dateutil.tz
|
||||
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 dissbled, return no status.
|
||||
@ -262,6 +262,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.
|
||||
@ -297,7 +298,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)
|
||||
@ -334,7 +335,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.
|
||||
|
@ -178,6 +178,10 @@ 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 installed in the system.
|
||||
return shell("check_output", ["/usr/bin/php", "-v"])[4:7]
|
||||
|
||||
if __name__ == "__main__":
|
||||
from web_update import get_web_domains
|
||||
env = load_environment()
|
||||
|
@ -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?
|
||||
@ -83,6 +83,7 @@ def do_web_update(env):
|
||||
|
||||
# Build an nginx configuration file.
|
||||
nginx_conf = read_conf("nginx-top.conf")
|
||||
nginx_conf = re.sub("{{phpver}}", get_php_version(), nginx_conf)
|
||||
|
||||
# Load the templates.
|
||||
template0 = read_conf("nginx.conf")
|
||||
|
@ -4,6 +4,8 @@
|
||||
# -o pipefail: don't ignore errors in the non-last command in a pipeline
|
||||
set -euo pipefail
|
||||
|
||||
# This global variable pinpoints the PHP version for the whole MiaB app
|
||||
# Upgrade it only with care and tests. Nextcloud versions depend on it.
|
||||
PHP_VER=8.0
|
||||
|
||||
function hide_output {
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script has moved.
|
||||
# Yet, keep it for some users still calling it (backward compatibility)
|
||||
management/cli.py "$@"
|
||||
|
@ -26,7 +26,7 @@ if [ ! -f $1/config.php ]; then
|
||||
fi
|
||||
|
||||
echo "Restoring backup from $1"
|
||||
service php8.0-fpm stop
|
||||
service php$PHP_VER-fpm stop
|
||||
|
||||
# remove the current ownCloud/Nextcloud installation
|
||||
rm -rf /usr/local/lib/owncloud/
|
||||
@ -45,5 +45,5 @@ chown www-data:www-data $STORAGE_ROOT/owncloud/config.php
|
||||
|
||||
sudo -u www-data php$PHP_VER /usr/local/lib/owncloud/occ maintenance:mode --off
|
||||
|
||||
service php8.0-fpm start
|
||||
service php$PHP_VER-fpm start
|
||||
echo "Done"
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
ADMIN=$(./mail.py user admins | head -n 1)
|
||||
ADMIN=$(./management/cli.py user admins | head -n 1)
|
||||
test -z "$1" || ADMIN=$1
|
||||
|
||||
echo I am going to unlock admin features for $ADMIN.
|
||||
|
Loading…
Reference in New Issue
Block a user