From 3b2351d9fa198be0477ee51b8c7ee147926a3667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 17 Jan 2022 11:41:32 +0100 Subject: [PATCH] Public path keep (#37) Revert the legacy variable public_path --- README.md | 2 +- README_fr.md | 2 +- conf/.env.example | 2 +- conf/nginx.conf | 2 +- manifest.json | 2 +- scripts/backup | 4 ++-- scripts/change_url | 2 +- scripts/install | 14 +++++++------- scripts/remove | 4 ++-- scripts/restore | 12 ++++++------ scripts/upgrade | 27 +++++++++++++++++---------- 11 files changed, 40 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index ba2f777..c7dda7c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Photo-management-system to manage and share photos -**Shipped version:** 4.4~ynh1 +**Shipped version:** 4.4~ynh2 **Demo:** https://lycheeorg.github.io/demo/ diff --git a/README_fr.md b/README_fr.md index 80a5d65..13cbe04 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Système de gestion de photos pour gérer et partager des photos -**Version incluse :** 4.4~ynh1 +**Version incluse :** 4.4~ynh2 **Démo :** https://lycheeorg.github.io/demo/ diff --git a/conf/.env.example b/conf/.env.example index 8c39b67..8d1f843 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -33,7 +33,7 @@ TIMEZONE=UTC # folders in which the files will be stored LYCHEE_DIST="__FINALPATH__/public/dist/" -LYCHEE_UPLOADS="__DATADIR__/uploads/" +LYCHEE_UPLOADS="__PUBLIC_PATH__/uploads/" # url to access those files # LYCHEE_DIST_URL="dist/" diff --git a/conf/nginx.conf b/conf/nginx.conf index fdcc175..0009a71 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,7 +26,7 @@ location ^~ __PATH__/ { } location __PATH__/uploads/ { - alias __DATADIR__/uploads/ ; + alias __PUBLIC_PATH__/uploads/ ; } # Include SSOWAT user panel. diff --git a/manifest.json b/manifest.json index 98657b4..1935ea7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Photo-management-system to manage and share photos", "fr": "Système de gestion de photos pour gérer et partager des photos" }, - "version": "4.4~ynh1", + "version": "4.4~ynh2", "url": "https://lycheeorg.github.io/", "upstream": { "license": "MIT", diff --git a/scripts/backup b/scripts/backup index 56014a2..f57412d 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,7 +24,7 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -44,7 +44,7 @@ ynh_backup --src_path="$final_path" # BACKUP MEDIA FOLDER #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$public_path" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 4f82112..f76a1eb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index d1c4688..e74cb54 100755 --- a/scripts/install +++ b/scripts/install @@ -90,15 +90,15 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +public_path=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=public_path --value=$public_path -mkdir -p $datadir/uploads -mkdir -p $datadir/uploads/{big,import,medium,raw,small,thumb} +mkdir -p $public_path/uploads +mkdir -p $public_path/uploads/{big,import,medium,raw,small,thumb} -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$public_path" +chmod -R o-rwx "$public_path" +chown -R $app:www-data "$public_path" #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index 7836318..0c9bc89 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name @@ -40,7 +40,7 @@ ynh_secure_remove --file="$final_path" if [ "$YNH_APP_PURGE" == true ] then ynh_script_progression --message="Removing $app data directory..." --weight=2 - ynh_secure_remove --file="$datadir" + ynh_secure_remove --file="$public_path" fi #================================================= diff --git a/scripts/restore b/scripts/restore index e36683b..eee100f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -71,13 +71,13 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Restoring the data directory..." # Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$public_path" --not_mandatory -mkdir -p $datadir +mkdir -p $public_path -chmod 755 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 755 "$public_path" +chmod -R o-rwx "$public_path" +chown -R $app:www-data "$public_path" #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 9603c65..dbf9ab3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) phpversion=$YNH_PHP_VERSION @@ -61,14 +61,23 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If new datadir doesn't exist, create it +# If public_path doesn't exist, create it +if [ -z "$public_path" ]; then + public_path=/home/yunohost.app/$app + mkdir -p $public_path + chmod 755 $public_path + chown -R $app:www-data $public_path + ynh_app_setting_set --app=$app --key=public_path --value=$public_path +fi + +# If new "/home/yunohost.app/$app" doesn't exist, create it if [ -z "/home/yunohost.app/$app" ]; then - datadir=/home/yunohost.app/$app - mkdir -p $datadir - chmod 755 $datadir - chown -R $app:www-data $datadir - ynh_app_setting_set --app=$app --key=datadir --value=$datadir - cp -a "$final_path/public/uploads" "$datadir/uploads" + public_path=/home/yunohost.app/$app + mkdir -p $public_path + chmod 755 $public_path + chown -R $app:www-data $public_path + ynh_app_setting_set --app=$app --key=public_path --value=$public_path + cp -a "$final_path/public/uploads" "$public_path/uploads" fi # Cleaning legacy permissions @@ -141,8 +150,6 @@ ynh_script_progression --message="Setting $app config..." # Setup application config #ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" -#ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css" - ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\ 'ffmpeg.binaries' => '/usr/bin/ffmpeg',\ 'ffprobe.binaries' => '/usr/bin/ffprobe',\