#!/bin/bash source /usr/share/yunohost/helpers source _common.sh ynh_trap_on export app=$YNH_APP_INSTANCE_NAME user=$app export domain=$(ynh_app_setting_get $app domain) export path=$(ynh_app_setting_get $app path) export admin=$(ynh_app_setting_get $app admin) db_pwd=$(ynh_app_setting_get $app mysqlpwd) export local_path=$(ynh_app_setting_get $app local_path) export is_public=$(ynh_app_setting_get $app is_public) is_public=${is_public:-0} export prefix=$(ynh_app_setting_get $app prefix) prefix=${prefix:-prefix_} version=$(ynh_read_json "/etc/yunohost/apps/$app/manifest.json" 'version' 2> /dev/null || echo '2.0.5') last_version=$(ynh_read_manifest 'version') ynh_exit_if_up_to_date ynh_check_var "$app" "app name not set" ynh_user_exists "$admin" || err "User does not exist: $admin" ynh_normalize_url_path "$path" if [ "${version}" = "2.0.5" ]; then ynh_save_args path is_public prefix ynh_app_dependencies php5-imap ynh_system_user_create "$user" "$local_path" # Move the upload dir to local_path if needed # The upload dir can't be symlinked in home (not supported by LS) upload_path=/home/yunohost.app/$app/upload if [ -h $local_path/upload ]; then sudo rm $local_path/upload sudo mv $upload_path $local_path/ fi ynh_app_setting_delete $app skipped_uris ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts" ynh_configure_php_fpm ynh_configure_nginx ynh_configure migrations/2.0.5.sql ./2.0.5.sql mysql -u $app -p$db_pwd $app < ./2.0.5.sql fi # Backup config, plugins and themes and delete previous files ynh_save_persistent modules themes plugins ynh_save_persistent data application/config/config.php upload # Copie new files and restore config, plugins, upload and themes sudo rm -Rf $local_path ynh_setup_source "$local_path" "$user" # Set permissions ynh_set_default_perm $local_path sudo chmod -R u+w $local_path/tmp sudo chmod -R u+w $local_path/upload sudo chmod -R u+w $local_path/application/config/ # Migrate DB cd $local_path/application/commands ynh_exec_as "$app" php console.php update