From 92ae8e7d36a2bb7d1d56b21d1a3251f6b0b61102 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Fri, 9 Feb 2024 21:04:37 +0100 Subject: [PATCH] Fixes in php for arch --- admin/app.py | 19 ++++++++++++++----- scripts/check_php.sh | 5 +++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/admin/app.py b/admin/app.py index 75e41d7..00168eb 100644 --- a/admin/app.py +++ b/admin/app.py @@ -621,13 +621,18 @@ def edit_virtualhost(virtualhost_id): db=g.connection - vhost=VirtualHost(db) + virtual=VirtualHost(db) + + #arr_vhost=virtual.select_a_row(virtualhost_id, [], True) + with virtual.query('select virtualhost.*, webserver.id, serverdbtask.distro from virtualhost, webserver, serverdbtask WHERE virtualhost.id=%s AND virtualhost.webserver_id=webserver.id AND webserver.server_id=serverdbtask.id', [virtualhost_id]) as cursor: + + arr_vhost=cursor.fetchone() + + #{'id': 3, 'domain': 'wp.cuchulu.com', 'home': '/home/developer/sites/wp.cuchulu.com', 'username': 'developer', 'webserver_id': 13, 'ip': '', 'port': 0, 'ssl_port': 0, 'cgi_type': '', 'ssl': 0, 'aliases': '', 'redirect_ssl': 0, 'indexes': 0, 'allow_override': 1, 'php': '', 'webserver.id': 13, 'distro': 'arch'} - arr_vhost=vhost.select_a_row(virtualhost_id, [], True) - if arr_vhost: - virtual=VirtualHost(db) + #virtual=VirtualHost(db) virtual.fields['aliases'].label=I18n.lang('webservers', 'domain_alias', 'Domain aliases') virtual.fields['aliases'].help=I18n.lang('webservers', 'domain_alias_explain', 'Domain aliases are the other domain names of this server. For example www.domain.com, other-site.domain.com. You can separate the domains with commas') @@ -667,7 +672,11 @@ def edit_virtualhost(virtualhost_id): virtual.fields['php'].label=I18n.lang('webservers', 'php_support', 'PHP support') virtual.fields['php'].name_form=SelectForm - virtual.fields['php'].extra_parameters=[{'': 'No php support', '7.4': 'PHP 7.4', '8.0': 'PHP 8.0', '8.1': 'PHP 8.1', '8.2': 'PHP 8.2', '8.3': 'PHP 8.3'}] + if arr_vhost['distro']!='arch': + virtual.fields['php'].extra_parameters=[{'': 'No php support', '7.4': 'PHP 7.4', '8.0': 'PHP 8.0', '8.1': 'PHP 8.1', '8.2': 'PHP 8.2', '8.3': 'PHP 8.3'}] + else: + virtual.fields['php'].extra_parameters=[{'': 'No php support', '8.1': 'PHP 8.1 (On Arch, php-legacy for maximum compatibility)'}] + virtual.fields['php'].help=I18n.lang('webservers', 'add_php_support_to_virtualhost', 'Add support to php to virtualhost. You can choose ophp version that you prefer') #'port', 'ssl_port', diff --git a/scripts/check_php.sh b/scripts/check_php.sh index 9bc4696..ab574f6 100644 --- a/scripts/check_php.sh +++ b/scripts/check_php.sh @@ -226,7 +226,8 @@ elif [ "$DISTRO" = 'rocky' ] || [ "$DISTRO" = 'fedora' ]; then fi else - + + sudo pacman -Syu --noconfirm sudo pacman -S --needed --noconfirm php-legacy php-legacy-gd php-legacy-fpm php-legacy-sodium composer mariadb if [ $? -eq 0 ]; then @@ -235,7 +236,7 @@ else else - echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Cannot install php legacy in arch..."}' + echo '{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Cannot install php legacy in arch..."}' exit;