From b48d0ac7ca2b7ace1ee515b55978a070b7887a6d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 10:17:44 +0200 Subject: [PATCH 1/7] Add options --- conf/configuration.ini | 4 ++-- manifest.json | 20 ++++++++++++++++++++ scripts/install | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/conf/configuration.ini b/conf/configuration.ini index f3ec175..c991389 100644 --- a/conf/configuration.ini +++ b/conf/configuration.ini @@ -1,5 +1,5 @@ ; Titre de votre wiki -Title = ChuWiki For YunoHost +Title = __TITLE__ ; Permet de ne pas utiliser le PathInfo ; Si votre PHP fonctionne en mode CGI, vous devrez passez @@ -24,4 +24,4 @@ Renderer = wiki2xhtml ; Smileys, thème et langue à utiliser SmileyPath = smileys/dkmsn ThemePath = theme/default -LanguagePath = lang/en +LanguagePath = lang/__LANGUAGE__ diff --git a/manifest.json b/manifest.json index a9ebc54..6a313c2 100644 --- a/manifest.json +++ b/manifest.json @@ -42,6 +42,26 @@ "type": "path", "example": "/chuwiki", "default": "/chuwiki" + }, + { + "name": "titre", + "type": "string", + "ask": { + "en": "Choose a title for the wiki you want to create", + "fr": "Choisissez un titre pour le wiki que vous souhaitez créer" + }, + "example": "ChuWiki", + "default": "ChuWiki" + }, + { + "name": "language", + "type": "string", + "ask": { + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" + }, + "choices": ["fr", "en"], + "default": "fr" }, { "name": "is_public", diff --git a/scripts/install b/scripts/install index 659f42a..d0fbaf1 100755 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +title=$YNH_APP_ARG_TITLE app=$YNH_APP_INSTANCE_NAME @@ -44,6 +45,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=title --value=$title #================================================= # CREATE DEDICATED USER From 24c142abb6f9dbd5354b382ddaba9558661196e1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 10:37:27 +0200 Subject: [PATCH 2/7] Set content path --- conf/configuration.ini | 2 +- manifest.json | 4 ++-- scripts/backup | 6 ++++++ scripts/install | 16 ++++++++++++++-- scripts/remove | 3 +++ scripts/restore | 8 ++++++++ scripts/upgrade | 18 +++++++++--------- 7 files changed, 43 insertions(+), 14 deletions(-) diff --git a/conf/configuration.ini b/conf/configuration.ini index c991389..648e249 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 = pages +PagePath = __CONTENT_PATH__/pages ; Noms des scripts ; Vous devrez peut-être ajouter ".php" si votre serveur ne gère pas MultiViews diff --git a/manifest.json b/manifest.json index 6a313c2..4fd57e6 100644 --- a/manifest.json +++ b/manifest.json @@ -60,8 +60,8 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["fr", "en"], - "default": "fr" + "choices": ["en", "es", "fr", "zh"], + "default": "en" }, { "name": "is_public", diff --git a/scripts/backup b/scripts/backup index 75ce3e0..1251570 100755 --- a/scripts/backup +++ b/scripts/backup @@ -39,6 +39,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP CONTENT DIR +#================================================= + +ynh_backup --src_path="/home/yunohost.app/$app" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index d0fbaf1..a019eab 100755 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC title=$YNH_APP_ARG_TITLE +language=$YNH_APP_ARG_LANGUAGE app=$YNH_APP_INSTANCE_NAME @@ -45,7 +46,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=title --value=$title +#ynh_app_setting_set --app=$app --key=title --value=$title +#ynh_app_setting_set --app=$app --key=language --value=$language #================================================= # CREATE DEDICATED USER @@ -86,6 +88,16 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# CONTENT PATH CONFIGURATION +#================================================= + +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 + #================================================= # ADD A CONFIGURATION #================================================= @@ -94,7 +106,7 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/configuration.ini" --destination="$final_path/configuration.ini" chmod 400 "$final_path/configuration.ini" -chown $app: "$final_path/configuration.ini" +chown $app "$final_path/configuration.ini" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 4a7848b..6235979 100755 --- a/scripts/remove +++ b/scripts/remove @@ -27,6 +27,9 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" +# Remove the content directory securely +#ynh_secure_remove --file="/home/yunohost.app/$app" + #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 005644b..fa1263d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,6 +66,14 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# RESTORE CONTENT DIR +#================================================= + +ynh_restore_file --origin_path="/home/yunohost.app/$app" +chmod -R 750 "/home/yunohost.app/$app" +chown -R $app "/home/yunohost.app/$app" + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 63014f9..5c57b5f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,18 +68,18 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - # Create a temporary directory - tmpdir="$(mktemp -d)" - cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" + # # Create a temporary directory + # tmpdir="$(mktemp -d)" + # cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" - ynh_secure_remove --file="$final_path" + # ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/configuration.ini" - # Copy the admin saved settings from tmp directory to final config path - cp -a "$tmpdir/configuration.ini" "$final_path/configuration.ini" - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" + # # Copy the admin saved settings from tmp directory to final config path + # cp -a "$tmpdir/configuration.ini" "$final_path/configuration.ini" + # # Remove the tmp directory securely + # ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path" From 0db65a6dfbba724bf65efe054fa0aefb57e70f4b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 10:42:03 +0200 Subject: [PATCH 3/7] Update check_process --- check_process | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check_process b/check_process index d799db7..c50e856 100644 --- a/check_process +++ b/check_process @@ -2,6 +2,8 @@ ; Manifest domain="domain.tld" path="/path" + title="ChuWiki" + language="en" is_public=1 ; Checks pkg_linter=1 From 125e99c0fdb61f26e4ee153418e8cdff9c96ee29 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 10:45:06 +0200 Subject: [PATCH 4/7] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4fd57e6..f861f03 100644 --- a/manifest.json +++ b/manifest.json @@ -44,7 +44,7 @@ "default": "/chuwiki" }, { - "name": "titre", + "name": "title", "type": "string", "ask": { "en": "Choose a title for the wiki you want to create", From f3c6098337b37e58f68762bf896e2862f35cf068 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 10:48:36 +0200 Subject: [PATCH 5/7] Set max_body_size --- conf/nginx.conf | 1 + conf/php-fpm.conf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 703b7fb..92fac4e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,6 +10,7 @@ location __PATH__/ { } index index.php; + client_max_body_size 128M; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab1a471..8ecf58e 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -419,8 +419,8 @@ chdir = __FINALPATH__ ;php_admin_value[memory_limit] = 32M ; Common values to change to increase file upload limit -; php_admin_value[upload_max_filesize] = 50M -; php_admin_value[post_max_size] = 50M +php_admin_value[upload_max_filesize] = 128M +php_admin_value[post_max_size] = 128M ; php_admin_flag[mail.add_x_header] = Off ; Other common parameters From e271c903a57675735321f3a65231ed7175c62292 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 11:06:12 +0200 Subject: [PATCH 6/7] Update upgrade --- scripts/upgrade | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5c57b5f..0b97a09 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,18 +68,18 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - # # Create a temporary directory - # tmpdir="$(mktemp -d)" - # cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" + # Create a temporary directory + tmpdir="$(mktemp -d)" + cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" - # ynh_secure_remove --file="$final_path" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="$final_path/configuration.ini" + ynh_secure_remove --file="$final_path" + Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" #--keep="$final_path/configuration.ini" - # # Copy the admin saved settings from tmp directory to final config path - # cp -a "$tmpdir/configuration.ini" "$final_path/configuration.ini" - # # Remove the tmp directory securely - # ynh_secure_remove --file="$tmpdir" + # Copy the admin saved settings from tmp directory to final config path + cp -a "$tmpdir/configuration.ini" "$final_path/configuration.ini" + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path" From 278930fce56a77acd9b2b0162d7ca73ac2598875 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 11:40:34 +0200 Subject: [PATCH 7/7] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0b97a09..09355cd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,7 +73,7 @@ then cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" ynh_secure_remove --file="$final_path" - Download, check integrity, uncompress and patch the source from app.src + #Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" #--keep="$final_path/configuration.ini" # Copy the admin saved settings from tmp directory to final config path