From 90501d91e99976ee6e001813bde32f45bd82351a Mon Sep 17 00:00:00 2001 From: Nils VAN ZUIJLEN Date: Thu, 4 Mar 2021 18:09:37 +0100 Subject: [PATCH] Update upgrade script Follows https://docs.humhub.org/docs/admin/updating --- scripts/upgrade | 46 ++++++++++------------------------------------ 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 82dd48f..9ce5687 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -157,12 +157,18 @@ ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -# APPLY LDAP PATCHES +# MIGRATE DATABASE #================================================= -ynh_script_progression --message="Applying LDAP patches..." --time --weight=1 +ynh_script_progression --message="Migrating database..." --time --weight=1 -# Fix LDAP email. See https://github.com/humhub/humhub/issues/1949 -# Fix to allow passwordless LDAP login +sudo -u $app /usr/bin/php$YNH_PHP_VERSION $final_path/protected/yii migrate/up --includeModuleMigrations=1 + +#================================================= +# UPDATE MODULES +#================================================= +ynh_script_progression --message="Updating modules..." --time --weight=1 + +sudo -u $app /usr/bin/php$YNH_PHP_VERSION $final_path/protected/yii module/update-all #================================================= # REINSTALL CRONTAB @@ -171,19 +177,6 @@ ynh_script_progression --message="Upgrading crontab..." --time --weight=1 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/${app}" -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -# ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" - -# ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - -# Recalculate and store the checksum of the file for the next upgrade. -# ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= @@ -199,25 +192,6 @@ chown -R $app $final_path/protected/modules chown -R $app $final_path/protected/runtime chown -R $app $final_path/uploads/* -# This file contains the db password -chmod g-rwx o-rwx $final_path/protected/config/dynamic.php - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - -#================================================= -# UPGRADE FAIL2BAN -#================================================= -ynh_script_progression --message="Reconfiguring Fail2Ban..." --time --weight=1 - -# Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # RELOAD NGINX #=================================================