From fccec94ee55ef40a5a8bffc36b037ba6d76af4d0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Jun 2021 16:57:45 +0200 Subject: [PATCH 1/4] Set datadir --- manifest.json | 2 +- scripts/backup | 3 ++- scripts/install | 16 ++++++++++------ scripts/restore | 15 +++++++++++---- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index f861f03..e914e05 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A simple, fast and flexible wiki.", "fr": "Un wiki simple, rapide et flexible." }, - "version": "2.0~ynh1", + "version": "2.0~ynh2", "url": "http://chuwiki.genezys.net/", "upstream": { "license": "AGPL-3.0-only", diff --git a/scripts/backup b/scripts/backup index 1251570..948f7b9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -43,7 +44,7 @@ ynh_backup --src_path="$final_path" # BACKUP CONTENT DIR #================================================= -ynh_backup --src_path="/home/yunohost.app/$app" +ynh_backup --src_path="$datadir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index a019eab..b5e5e78 100755 --- a/scripts/install +++ b/scripts/install @@ -89,14 +89,18 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_add_fpm_config #================================================= -# CONTENT PATH CONFIGURATION +# CREATE DATA DIRECTORY #================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 -content_path=/home/yunohost.app/$app -mkdir -p $content_path -ynh_app_setting_set --app=$app --key=content_path --value=$content_path -chmod -R 750 $content_path -chown -R $app $content_path +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" #================================================= # ADD A CONFIGURATION diff --git a/scripts/restore b/scripts/restore index fa1263d..7b51070 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,6 +28,7 @@ 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) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -67,12 +68,18 @@ chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" #================================================= -# RESTORE CONTENT DIR +# RESTORE THE DATA DIRECTORY #================================================= +ynh_script_progression --message="Restoring the data directory..." --time --weight=1 -ynh_restore_file --origin_path="/home/yunohost.app/$app" -chmod -R 750 "/home/yunohost.app/$app" -chown -R $app "/home/yunohost.app/$app" +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +# this will be treated as a security issue. +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION From 8473f0ca899f7c720cd99bce30c1c13a7dcfba48 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 10 Jun 2021 14:57:53 +0000 Subject: [PATCH 2/4] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa94421..54aa45c 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 A simple, fast and flexible wiki. -**Shipped version:** 2.0~ynh1 +**Shipped version:** 2.0~ynh2 **Demo:** http://chuwiki.genezys.net/wiki/Bac%20%C3%A0%20sable diff --git a/README_fr.md b/README_fr.md index 56e46c2..4ff7576 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 Un wiki simple, rapide et flexible. -**Version incluse :** 2.0~ynh1 +**Version incluse :** 2.0~ynh2 **Démo :** http://chuwiki.genezys.net/wiki/Bac%20%C3%A0%20sable From 4b4ed0d083bb8f1391b24ccda147cf22f5b950b1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Jun 2021 14:58:50 +0200 Subject: [PATCH 3/4] Update configuration.ini --- conf/configuration.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/configuration.ini b/conf/configuration.ini index 648e249..b7bbeae 100644 --- a/conf/configuration.ini +++ b/conf/configuration.ini @@ -10,7 +10,7 @@ UsePathInfo = false ; Vous devez posséder le droit d'écriture sur ce répertoire ; S'il n'existe pas, il sera créé par ChuWiki mais devrez dans ce cas ; avoir les droits d'écriture dans le répertoire -PagePath = __CONTENT_PATH__/pages +PagePath = __DATADIR__/pages ; Noms des scripts ; Vous devrez peut-être ajouter ".php" si votre serveur ne gère pas MultiViews From 38cdfd6bb92de514d9ffb3989d63ae05d57eafbc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Aug 2021 09:07:55 +0200 Subject: [PATCH 4/4] Fix --- scripts/restore | 2 +- scripts/upgrade | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 7b51070..1c81c01 100755 --- a/scripts/restore +++ b/scripts/restore @@ -70,7 +70,7 @@ chown -R $app:www-data "$final_path" #================================================= # RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Restoring the data directory..." --time --weight=1 +ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$datadir" --not_mandatory diff --git a/scripts/upgrade b/scripts/upgrade index 09355cd..abd4457 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +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) #================================================= # CHECK VERSION @@ -45,6 +46,12 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If datadir doesn't exist, create it +if [ -z "$datadir" ]; then + datadir=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=datadir --value=$datadir +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all