mirror of
https://github.com/YunoHost-Apps/shaarli_ynh.git
synced 2024-09-03 20:26:10 +02:00
Patch2 (#61)
- Fix NGINX 302 redirect - Fix missing upgrade_type in upgrade script - Add ynh_smart_mktemp helper
This commit is contained in:
parent
45640ae344
commit
837c3942e7
3 changed files with 50 additions and 13 deletions
|
@ -9,24 +9,18 @@ location __PATH__/ {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
index index.php;
|
index index.html index.php;
|
||||||
if (!-f $request_filename) {
|
|
||||||
rewrite ^ __PATH__/index.php last;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
try_files $uri $uri/ /index.php?q=$uri&$args;
|
||||||
client_max_body_size 50M;
|
|
||||||
try_files $uri $uri/ index.php$is_args$args;
|
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
|
|
|
@ -20,6 +20,43 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-gettext
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Check available space before creating a temp directory.
|
||||||
|
#
|
||||||
|
# usage: ynh_smart_mktemp --min_size="Min size"
|
||||||
|
#
|
||||||
|
# | arg: -s, --min_size= - Minimal size needed for the temporary directory, in Mb
|
||||||
|
ynh_smart_mktemp () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [s]=min_size= )
|
||||||
|
local min_size
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
min_size="${min_size:-300}"
|
||||||
|
# Transform the minimum size from megabytes to kilobytes
|
||||||
|
min_size=$(( $min_size * 1024 ))
|
||||||
|
|
||||||
|
# Check if there's enough free space in a directory
|
||||||
|
is_there_enough_space () {
|
||||||
|
local free_space=$(df --output=avail "$1" | sed 1d)
|
||||||
|
test $free_space -ge $min_size
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_there_enough_space /tmp; then
|
||||||
|
local tmpdir=/tmp
|
||||||
|
elif is_there_enough_space /var; then
|
||||||
|
local tmpdir=/var
|
||||||
|
elif is_there_enough_space /; then
|
||||||
|
local tmpdir=/
|
||||||
|
elif is_there_enough_space /home; then
|
||||||
|
local tmpdir=/home
|
||||||
|
else
|
||||||
|
ynh_die "Insufficient free space to continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(mktemp --directory --tmpdir="$tmpdir")"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,6 +21,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue