mirror of
https://github.com/YunoHost-Apps/garradin_ynh.git
synced 2024-09-03 18:36:17 +02:00
cleaning syntax
This commit is contained in:
parent
7572a959cc
commit
35b475e068
4 changed files with 14 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue