1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lufi_ynh.git synced 2024-09-03 19:36:28 +02:00

check max_file_size

This commit is contained in:
Kayou 2019-03-03 18:52:39 +01:00
parent 06102b2ed9
commit 66f1f8d042
No known key found for this signature in database
GPG key ID: 823A2CBE071D3126
3 changed files with 14 additions and 0 deletions

View file

@ -112,6 +112,9 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf" ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf" ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf" ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi
ynh_replace_string "__SECRET__" "$secret" "${final_path}/lufi.conf" ynh_replace_string "__SECRET__" "$secret" "${final_path}/lufi.conf"
if [ $is_public -eq 0 ]; if [ $is_public -eq 0 ];

View file

@ -43,6 +43,11 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax # Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_normalize_url_path $path_url)
# Check if max_file_size is a number
if ! [[ $max_file_size =~ "^[\-0-9]+$" ]] && [ $max_file_size -lt 0 ]; then
ynh_die "Max file must be a number positive or zero"
fi
# Check web path availability # Check web path availability
ynh_webpath_available $domain $path_url ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
@ -132,6 +137,9 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf" ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf" ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf" ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi
secret=$(ynh_string_random 24) secret=$(ynh_string_random 24)
ynh_app_setting_set $app secret $secret ynh_app_setting_set $app secret $secret

View file

@ -116,6 +116,9 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf" ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf" ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf" ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi
ynh_replace_string "__SECRET__" "$secret" "${final_path}/lufi.conf" ynh_replace_string "__SECRET__" "$secret" "${final_path}/lufi.conf"
if [ $is_public -eq 0 ]; if [ $is_public -eq 0 ];