diff --git a/scripts/change_url b/scripts/change_url index 93fd82a..7244972 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -43,14 +43,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then +if [ "$old_domain" != "$new_domain" ]; then change_domain=1 fi change_path=0 -if [ "$old_path" != "$new_path" ] -then +if [ "$old_path" != "$new_path" ]; then change_path=1 fi @@ -76,19 +74,16 @@ then fi # change the config.local.conf -if [ $change_path -eq 1 ] && [ "$new_path" == "/" ] -then +if [ $change_path -eq 1 ] && [ "$new_path" == "/" ]; then ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path';" --target_file="$final_path/config.local.php" -elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ] -then +elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ]; then ynh_replace_string --match_string="const WWW_URI = '$old_path';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php" else [ $change_path -eq 1 ] ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php" fi # Change the domain for nginx -if [ $change_domain -eq 1 ] -then +if [ $change_domain -eq 1 ]; then # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf diff --git a/scripts/install b/scripts/install index 062eb91..744f84c 100644 --- a/scripts/install +++ b/scripts/install @@ -121,11 +121,13 @@ systemctl reload nginx #================================================= # MODIFY A CONFIG FILE #================================================= -key=$(ynh_string_random --length=50) +# copy config.dist.php creating config.local.php cp -a $final_path/config.dist.php $final_path/config.local.php +# create a key for the secret key CSFR; +key=$(ynh_string_random --length=50) +# edit config.local.php ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" -if [ "$path_url" == "/" ] -then +if [ "$path_url" == "/" ]; then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" diff --git a/scripts/restore b/scripts/restore index 75164ec..53d9726 100644 --- a/scripts/restore +++ b/scripts/restore @@ -83,8 +83,7 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 # Define and install dependencies -ynh_install_app_dependencies php7.0-sqlite3 - +ynh_install_app_dependencies $pkg_dependencies #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 1f53880..eaeffbf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,20 +53,18 @@ if [ -z "$final_path" ]; then fi #================================================= -# Backup squlite, config.local.php and squelettes directory +# Backup Data #================================================= ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --time --weight=1 bdd=$final_path/association.sqlite squelettes=$final_path/www/squelettes -if [ -d "$squelettes" ] -then +if [ -d "$squelettes" ]; then cp -ar $squelettes /tmp/squelettes fi -if [ -e "$bdd" ] -then +if [ -e "$bdd" ]; then cp -a $bdd /tmp/association.sqlite fi