From a93ec8dda9704af0d086019c659da5a414832a13 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Nov 2021 12:30:06 +0100 Subject: [PATCH] Fix --- conf/app.src | 1 - conf/nginx.conf | 38 ++++++++++++++++---------------------- manifest.json | 8 +++----- scripts/_common.sh | 2 +- scripts/install | 13 ++++++++++--- scripts/remove | 12 ++++++++++-- scripts/restore | 11 ++++++++++- scripts/upgrade | 9 ++++++++- 8 files changed, 58 insertions(+), 36 deletions(-) diff --git a/conf/app.src b/conf/app.src index 9dbea46..10c19ef 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,3 @@ SOURCE_SUM=90ca90c4afa37dadc8a4743b5cb111b20cda5f983ce073c2c0bebdce64fa822a SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index 2b5cf35..8cb8a21 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,30 +7,24 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/; + # Path to source + alias __FINALPATH__/; - index index.php; - if (!-e $request_filename) - { - rewrite ^(.+)$ __PATH__/index.php?q=$1 last; - } + index index.php; + if (!-e $request_filename) { + rewrite ^(.+)$ __PATH__/index.php?q=$1 last; + } - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - client_max_body_size 30m; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + client_max_body_size 30m; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + } # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.json b/manifest.json index 7b0789d..592dcc8 100644 --- a/manifest.json +++ b/manifest.json @@ -24,7 +24,7 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -36,8 +36,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "path", @@ -47,8 +46,7 @@ }, { "name": "admin", - "type": "user", - "example": "john" + "type": "user" }, { "name": "language", diff --git a/scripts/_common.sh b/scripts/_common.sh index 4404f4b..a0a56fb 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="7.3" -extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-ssh2 php${YNH_PHP_VERSION}-tokenizer php${YNH_PHP_VERSION}-ldap" +pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-ssh2 php${YNH_PHP_VERSION}-tokenizer php${YNH_PHP_VERSION}-ldap" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/install b/scripts/install index 7e8dd21..119bf98 100644 --- a/scripts/install +++ b/scripts/install @@ -59,12 +59,19 @@ ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=1 ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # STANDARD MODIFICATIONS #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) ynh_app_setting_set --app=$app --key=db_name --value=$db_name @@ -108,7 +115,7 @@ else usage=high fi # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$usage --footprint=medium --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$usage --footprint=medium phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -120,7 +127,7 @@ ynh_script_progression --message="Configuring WordPress..." cp ../conf/wp-config.php $final_path/wp-config.php # Change variables in Wordpress configuration -ynh_replace_string --match_string="__DB_USER__" --replace_string=$db_name --target_file=$final_path/wp-config.php +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file=$final_path/wp-config.php ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$final_path/wp-config.php for i in 1 2 3 4 5 6 7 8 diff --git a/scripts/remove b/scripts/remove index d48c28a..14cdc00 100755 --- a/scripts/remove +++ b/scripts/remove @@ -30,10 +30,18 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=2 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -41,7 +49,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index bde343a..a0ef6c1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,7 @@ chmod 640 $final_path/wp-config.php ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint #================================================= # RESTORE THE FAIL2BAN CONFIGURATION @@ -110,9 +110,18 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE CRON #================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file "/etc/cron.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index b911bb7..a4750c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -183,6 +183,13 @@ then ynh_add_nginx_config fi +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -200,7 +207,7 @@ if [ $overwrite_phpfpm -eq 1 ] then ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 # Create a dedicated PHP-FPM config - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint fi #=================================================