mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
bookworm: add php7.x -> php8.2 autopatch
This commit is contained in:
parent
7fc7d188ad
commit
0901298935
3 changed files with 39 additions and 25 deletions
|
@ -3044,10 +3044,10 @@ def _assert_system_is_sane_for_app(manifest, when):
|
|||
|
||||
services = manifest.get("services", [])
|
||||
|
||||
# Some apps use php-fpm, php5-fpm or php7.x-fpm which is now php7.4-fpm
|
||||
# Some apps use php-fpm, php5-fpm or php7.x-fpm which is now php8.2-fpm
|
||||
def replace_alias(service):
|
||||
if service in ["php-fpm", "php5-fpm", "php7.0-fpm", "php7.3-fpm"]:
|
||||
return "php7.4-fpm"
|
||||
if service in ["php-fpm", "php5-fpm", "php7.0-fpm", "php7.3-fpm", "php7.4-fpm"]:
|
||||
return "php8.2-fpm"
|
||||
else:
|
||||
return service
|
||||
|
||||
|
@ -3056,7 +3056,7 @@ def _assert_system_is_sane_for_app(manifest, when):
|
|||
# We only check those, mostly to ignore "custom" services
|
||||
# (added by apps) and because those are the most popular
|
||||
# services
|
||||
service_filter = ["nginx", "php7.4-fpm", "mysql", "postfix"]
|
||||
service_filter = ["nginx", "php8.2-fpm", "mysql", "postfix"]
|
||||
services = [str(s) for s in services if s in service_filter]
|
||||
|
||||
if "nginx" not in services:
|
||||
|
|
|
@ -1204,7 +1204,7 @@ class RestoreManager:
|
|||
|
||||
def _patch_legacy_php_versions_in_csv_file(self):
|
||||
"""
|
||||
Apply dirty patch to redirect php5 and php7.0 files to php7.4
|
||||
Apply dirty patch to redirect php5 and php7.x files to php8.2
|
||||
"""
|
||||
from yunohost.utils.legacy import LEGACY_PHP_VERSION_REPLACEMENTS
|
||||
|
||||
|
|
|
@ -163,32 +163,45 @@ def translate_legacy_default_app_in_ssowant_conf_json_persistent():
|
|||
|
||||
|
||||
LEGACY_PHP_VERSION_REPLACEMENTS = [
|
||||
("/etc/php5", "/etc/php/7.4"),
|
||||
("/etc/php/7.0", "/etc/php/7.4"),
|
||||
("/etc/php/7.3", "/etc/php/7.4"),
|
||||
("/var/run/php5-fpm", "/var/run/php/php7.4-fpm"),
|
||||
("/var/run/php/php7.0-fpm", "/var/run/php/php7.4-fpm"),
|
||||
("/var/run/php/php7.3-fpm", "/var/run/php/php7.4-fpm"),
|
||||
("php5", "php7.4"),
|
||||
("php7.0", "php7.4"),
|
||||
("php7.3", "php7.4"),
|
||||
('YNH_PHP_VERSION="7.3"', 'YNH_PHP_VERSION="7.4"'),
|
||||
("/etc/php5", "/etc/php/8.2"),
|
||||
("/etc/php/7.0", "/etc/php/8.2"),
|
||||
("/etc/php/7.3", "/etc/php/8.2"),
|
||||
("/etc/php/7.4", "/etc/php/8.2"),
|
||||
("/var/run/php5-fpm", "/var/run/php/php8.2-fpm"),
|
||||
("/var/run/php/php7.0-fpm", "/var/run/php/php8.2-fpm"),
|
||||
("/var/run/php/php7.3-fpm", "/var/run/php/php8.2-fpm"),
|
||||
("/var/run/php/php7.4-fpm", "/var/run/php/php8.2-fpm"),
|
||||
("php5", "php8.2"),
|
||||
("php7.0", "php8.2"),
|
||||
("php7.3", "php8.2"),
|
||||
("php7.4", "php8.2"),
|
||||
('YNH_PHP_VERSION="7.3"', 'YNH_PHP_VERSION="8.2"'),
|
||||
('YNH_PHP_VERSION="7.4"', 'YNH_PHP_VERSION="8.2"'),
|
||||
(
|
||||
'phpversion="${phpversion:-7.0}"',
|
||||
'phpversion="${phpversion:-7.4}"',
|
||||
'phpversion="${phpversion:-8.2}"',
|
||||
), # Many helpers like the composer ones use 7.0 by default ...
|
||||
(
|
||||
'phpversion="${phpversion:-7.3}"',
|
||||
'phpversion="${phpversion:-8.2}"',
|
||||
), # Many helpers like the composer ones use 7.0 by default ...
|
||||
(
|
||||
'phpversion="${phpversion:-7.4}"',
|
||||
'phpversion="${phpversion:-8.2}"',
|
||||
), # Many helpers like the composer ones use 7.0 by default ...
|
||||
(
|
||||
'"$phpversion" == "7.0"',
|
||||
'$(bc <<< "$phpversion >= 7.4") -eq 1',
|
||||
'$(bc <<< "$phpversion >= 8.2") -eq 1',
|
||||
), # patch ynh_install_php to refuse installing/removing php <= 7.3
|
||||
(
|
||||
'"$phpversion" == "7.3"',
|
||||
'$(bc <<< "$phpversion >= 7.4") -eq 1',
|
||||
'$(bc <<< "$phpversion >= 8.2") -eq 1',
|
||||
), # patch ynh_install_php to refuse installing/removing php <= 7.3
|
||||
(
|
||||
'"$phpversion" == "7.4"',
|
||||
'$(bc <<< "$phpversion >= 8.2") -eq 1',
|
||||
), # patch ynh_install_php to refuse installing/removing php <= 7.3
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -217,15 +230,16 @@ def _patch_legacy_php_versions(app_folder):
|
|||
def _patch_legacy_php_versions_in_settings(app_folder):
|
||||
settings = read_yaml(os.path.join(app_folder, "settings.yml"))
|
||||
|
||||
if settings.get("fpm_config_dir") in ["/etc/php/7.0/fpm", "/etc/php/7.3/fpm"]:
|
||||
settings["fpm_config_dir"] = "/etc/php/7.4/fpm"
|
||||
if settings.get("fpm_service") in ["php7.0-fpm", "php7.3-fpm"]:
|
||||
settings["fpm_service"] = "php7.4-fpm"
|
||||
if settings.get("phpversion") in ["7.0", "7.3"]:
|
||||
settings["phpversion"] = "7.4"
|
||||
if settings.get("fpm_config_dir") in ["/etc/php/7.0/fpm", "/etc/php/7.3/fpm", "/etc/php/7.4/fpm"]:
|
||||
settings["fpm_config_dir"] = "/etc/php/8.2/fpm"
|
||||
if settings.get("fpm_service") in ["php7.0-fpm", "php7.3-fpm", "php7.4-fpm"]:
|
||||
settings["fpm_service"] = "php8.2-fpm"
|
||||
if settings.get("phpversion") in ["7.0", "7.3", "7.4"]:
|
||||
settings["phpversion"] = "8.2"
|
||||
|
||||
# We delete these checksums otherwise the file will appear as manually modified
|
||||
list_to_remove = [
|
||||
"checksum__etc_php_7.4_fpm_pool",
|
||||
"checksum__etc_php_7.3_fpm_pool",
|
||||
"checksum__etc_php_7.0_fpm_pool",
|
||||
"checksum__etc_nginx_conf.d",
|
||||
|
|
Loading…
Add table
Reference in a new issue