1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/framaforms_ynh.git synced 2024-09-03 18:36:12 +02:00

Upgrade to PHP7.3

This commit is contained in:
yalh76 2020-03-29 05:02:23 +02:00
parent b45862d6ea
commit 3f97adb5cf
10 changed files with 145 additions and 119 deletions

View file

@ -58,7 +58,7 @@ location __PATH__/ {
location ~ '[^/]\.php$|^/update.php' { location ~ '[^/]\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php7.3-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php/php7.2-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php7.3-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)

Binary file not shown.

View file

@ -6,7 +6,7 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql curl libzip-dev" pkg_dependencies="postgresql curl libzip-dev"
extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-uploadprogress php7.2-pgsql" extra_pkg_dependencies="php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql php7.3-xml php7.3-ldap php7.3-mbstring php7.3-uploadprogress php7.3-pgsql"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -33,31 +33,31 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 ynh_script_progression --message="Backing up the main app directory..." --weight=1
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
ynh_script_progression --message="Backing up the answer files..." --time --weight=1 ynh_script_progression --message="Backing up the answer files..." --weight=1
ynh_backup --src_path="/home/yunohost.app/$app/data" --is_big=1 ynh_backup --src_path="/home/yunohost.app/$app/data" --is_big=1
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1 ynh_script_progression --message="Backing up php-fpm configuration..." --weight=1
ynh_backup --src_path="/etc/php/7.2/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/7.3/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backing up the PostgreSQL database..." --time --weight=1 ynh_script_progression --message="Backing up the PostgreSQL database..." --weight=1
ynh_psql_dump_db --database="$db_name" > db.sql ynh_psql_dump_db --database="$db_name" > db.sql
@ -69,4 +69,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -24,13 +24,30 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application # Add settings here as needed by your application
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================
@ -52,7 +69,7 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -83,24 +100,22 @@ fi
#================================================= #=================================================
# UPDATE DRUSH ALIAS # UPDATE DRUSH ALIAS
#================================================= #=================================================
ynh_print_info --message="Updating Drush alias..." ynh_script_progression --message="Updating Drush alias..." --weight=1
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php"
cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$drush_aliasconfig"
#=================================================
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#=================================================
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -108,4 +123,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --time --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -7,11 +7,11 @@
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers
source ynh_add_extra_apt_repos__3 source ynh_add_extra_apt_repos__3
source ynh_install_php__3 source ynh_install_php__3
source ynh_composer__2 source ynh_composer__2
source ynh_exec_as source ynh_exec_as
source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
@ -49,15 +49,25 @@ ynh_save_args domain path_url password is_public final_path
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL PHP7.3
#================================================= #=================================================
if [ "$(lsb_release --codename --short)" = "buster" ]; then
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
ynh_script_progression --message="Installing PHP7.3..." --weight=1
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_script_progression --message="Installing dependencies..." --weight=7
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE A PostgreSQL DATABASE # CREATE A POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
@ -92,22 +102,6 @@ ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# INSTALL PHP 7.2
#=================================================
ynh_script_progression --message="Installing PHP 7.2..." --weight=35
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=1
# Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="7.2"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -116,13 +110,13 @@ ynh_add_fpm_config --phpversion="7.2"
ynh_script_progression --message="Creating Drush alias..." --weight=2 ynh_script_progression --message="Creating Drush alias..." --weight=2
mkdir -p "$final_path/.drush" mkdir -p "$final_path/.drush"
drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php"
cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig"
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$drush_aliasconfig"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
#================================================= #=================================================
# INSTALL COMPOSER # INSTALL COMPOSER
@ -133,12 +127,12 @@ mkdir -p "$final_path/.composer"
cp -f "../conf/composer.json" "$final_path/.composer/composer.json" cp -f "../conf/composer.json" "$final_path/.composer/composer.json"
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer"
export PATH="$final_path/.composer/vendor/bin:$PATH" export PATH="$final_path/.composer/vendor/bin:$PATH"
#================================================= #=================================================
# Database initialization # INITIALIZE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Initializing PostgreSQL database..." --weight=8 ynh_script_progression --message="Initializing PostgreSQL database..." --weight=8
@ -146,7 +140,7 @@ ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql"
ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name" ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name"
#================================================= #=================================================
# Initialize tmp and private directory # INITIALIZE TMP AND PRIVATE DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Initializing tmp and private directory..." --weight=1 ynh_script_progression --message="Initializing tmp and private directory..." --weight=1
@ -159,7 +153,7 @@ chown -R $app: "/home/yunohost.app/$app/data"
chmod 775 "/home/yunohost.app/$app/data" chmod 775 "/home/yunohost.app/$app/data"
#================================================= #=================================================
# Missing images # ADD MISSING IMAGES
#================================================= #=================================================
ynh_script_progression --message="Adding missing images..." --weight=2 ynh_script_progression --message="Adding missing images..." --weight=2
@ -182,13 +176,13 @@ ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --targ
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config_file" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config_file"
#================================================= #=================================================
# Change admin password and apply custom conf # CHANGE ADMIN PASSWORD AND APPLY CUSTOM CONF
#================================================= #=================================================
ynh_script_progression --message="Changing admin password..." --weight=19 ynh_script_progression --message="Changing admin password..." --weight=19
chown -R $app: $final_path chown -R $app: $final_path
update-alternatives --set php /usr/bin/php7.2 update-alternatives --set php /usr/bin/php7.3
ynh_exec_as $app env PATH=$PATH drush @$app upwd --password="$password" "admin" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app upwd --password="$password" "admin" 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" 2>&1
@ -218,6 +212,14 @@ ynh_store_file_checksum --file="$config_file"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=1
# Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="7.3"
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================

View file

@ -7,13 +7,13 @@
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers
source ynh_install_php__3 source ynh_install_php__3
source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -25,13 +25,29 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE THE PostgresSQL DATABASE # REMOVE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the database..." --weight=1 ynh_script_progression --message="Removing the database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#=================================================
# REMOVE PHP
#=================================================
if [ "$(lsb_release --codename --short)" != "buster" ]; then
ynh_print_info --message="Removing php..."
ynh_remove_php
fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
@ -56,23 +72,9 @@ ynh_script_progression --message="Removing nginx web server configuration..." --
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE PHP
#=================================================
ynh_script_progression --message="Removing php..." --weight=14
ynh_remove_php
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -8,11 +8,11 @@
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/ynh_add_extra_apt_repos__3 source ../settings/scripts/ynh_add_extra_apt_repos__3
source ../settings/scripts/ynh_install_php__3 source ../settings/scripts/ynh_install_php__3
source ../settings/scripts/ynh_composer__2 source ../settings/scripts/ynh_composer__2
source ../settings/scripts/ynh_exec_as source ../settings/scripts/ynh_exec_as
source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
@ -24,7 +24,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --time --weight=1 ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -37,7 +37,7 @@ db_user=$db_name
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
@ -49,14 +49,14 @@ test ! -d $final_path \
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_print_info --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE ALL FILES # RESTORE ALL FILES
#================================================= #=================================================
ynh_script_progression --message="Restoring all files..." --time --weight=1 ynh_script_progression --message="Restoring all files..." --weight=1
ynh_restore ynh_restore
@ -74,26 +74,29 @@ chmod 775 "/home/yunohost.app/$app/data"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# REINSTALL PHP7.3
#=================================================
if [ "$(lsb_release --codename --short)" = "buster" ]; then
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
ynh_print_info --message="Reinstalling PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# REINSTALL PHP # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Reinstalling php..." ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
#=================================================
# RESTORE THE DATABASE
#=================================================
ynh_script_progression --message="Restoring the database..." --time --weight=1
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
@ -106,13 +109,13 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_systemd_action --service_name=php7.2-fpm --action=reload ynh_systemd_action --service_name=php7.3-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -7,11 +7,11 @@
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers
source ynh_add_extra_apt_repos__3 source ynh_add_extra_apt_repos__3
source ynh_install_php__3 source ynh_install_php__3
source ynh_composer__2 source ynh_composer__2
source ynh_exec_as source ynh_exec_as
source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
@ -74,6 +74,14 @@ ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -87,12 +95,22 @@ then
fi fi
#================================================= #=================================================
# NGINX CONFIGURATION # UPGRADE PHP7.3
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config if [ "$(lsb_release --codename --short)" = "buster" ]; then
ynh_add_nginx_config pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
if [ "$(ynh_app_setting_get --app=$app --key=php_version)" != "7.3" ]; then
ynh_print_info --message="Upgrading PHP7.3..."
ynh_remove_fpm_config
ynh_remove_app_dependencies
ynh_remove_php
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
else
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
fi
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -109,20 +127,13 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# UPGRADE PHP
#=================================================
ynh_script_progression --message="Upgrading PHP..." --weight=12
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1 ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="7.2" ynh_add_fpm_config --phpversion="7.3"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -131,24 +142,24 @@ ynh_add_fpm_config --phpversion="7.2"
#================================================= #=================================================
ynh_script_progression --message="Upgrading Composer..." --weight=3 ynh_script_progression --message="Upgrading Composer..." --weight=3
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer"
#================================================= #=================================================
# UPGRADE DRUPAL # UPGRADE DRUPAL
#================================================= #=================================================
ynh_script_progression --message="Upgrading Drupal..." --time --weight=30 ynh_script_progression --message="Upgrading Drupal..." --weight=30
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
export PATH="$final_path/.composer/vendor/bin:$PATH" export PATH="$final_path/.composer/vendor/bin:$PATH"
update-alternatives --set php /usr/bin/php7.2 update-alternatives --set php /usr/bin/php7.3
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
ynh_exec_as $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
update-alternatives --set php /usr/bin/php7.0 update-alternatives --set php /usr/bin/php7.0
@ -162,16 +173,9 @@ ynh_store_file_checksum --file="$config_file"
#================================================= #=================================================
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
config_file=$final_path/sites/default/settings.php
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config_file"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
@ -185,7 +189,7 @@ chmod 775 "/home/yunohost.app/$app/data"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
@ -197,7 +201,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -205,4 +209,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --time --last ynh_script_progression --message="Upgrade of $app completed" --last