From b2ed27f41827927935ab18b2897a9b90a2709897 Mon Sep 17 00:00:00 2001 From: ewilly Date: Tue, 25 Jul 2017 19:12:31 +0200 Subject: [PATCH] Fix #28 --- scripts/_common.sh | 15 +++++++++++++++ scripts/install | 4 ++++ scripts/upgrade | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index bfde399..83aa435 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -89,6 +89,21 @@ myynh_remove_fpm_config () { sudo systemctl restart php5-fpm } +# Update the according fo filesize +myynh_update_bozon_auto_dropzone () { + case ${filesize: -1} in + g|G) + max_length=$((${filesize%?}*1024)) + ;; + *) + max_length=${filesize%?} + ;; + esac + if [ -e "$bozon_auto_dropzone_php" ];then + ynh_replace_string "'max_length'=>2048" "'max_length'=>$max_length" "$bozon_auto_dropzone_php" + fi +} + #================================================= # FUTURE YUNOHOST HELPERS - TO BE REMOVED LATER #================================================= diff --git a/scripts/install b/scripts/install index adbeb9b..6b328fa 100644 --- a/scripts/install +++ b/scripts/install @@ -21,6 +21,7 @@ backup_core_only=$YNH_APP_ARG_BACKUP_CORE_ONLY final_path="/var/www/$app" data_path="/home/yunohost.app/$app" bozon_conf="$final_path/config.php" +bozon_auto_dropzone_php="$final_path/core/auto_dropzone.php" nginx_conf="/etc/nginx/conf.d/$domain.d/$app.conf" phpfpm_conf="/etc/php5/fpm/pool.d/$app.conf" @@ -66,6 +67,9 @@ sudo mv "$TMPDIR" "$final_path" ynh_replace_string "default_language='en'" "default_language='$language'" "$bozon_conf" ynh_store_file_checksum "$bozon_conf" +# update auto_dropzone.php +myynh_update_bozon_auto_dropzone + # create private & data folders myynh_create_dir "$final_path/private" myynh_create_dir "$data_path/uploads" diff --git a/scripts/upgrade b/scripts/upgrade index 916176d..a024b5e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ backup_core_only=$(ynh_app_setting_get "$app" backup_core_only) final_path="/var/www/$app" data_path="/home/yunohost.app/$app" bozon_conf="$final_path/config.php" +bozon_auto_dropzone_php="$final_path/core/auto_dropzone.php" nginx_conf="/etc/nginx/conf.d/$domain.d/$app.conf" phpfpm_conf="/etc/php5/fpm/pool.d/$app.conf" @@ -73,6 +74,9 @@ fi sudo cp -a "$TMPDIR/." "$final_path" sudo rm -R "$TMPDIR" +# update auto_dropzone.php +myynh_update_bozon_auto_dropzone + # set permissions myynh_set_permissions