mirror of
https://github.com/YunoHost-Apps/bookstack_ynh.git
synced 2024-09-03 18:16:02 +02:00
Add maintenance
This commit is contained in:
parent
e61dea3910
commit
0d8ae4a981
2 changed files with 32 additions and 0 deletions
|
@ -3,6 +3,14 @@ version = "1.0"
|
||||||
[main]
|
[main]
|
||||||
name = "BookStack configuration"
|
name = "BookStack configuration"
|
||||||
|
|
||||||
|
[main.maintenance_mode]
|
||||||
|
name = "Maintenance mode"
|
||||||
|
|
||||||
|
[main.maintenance_mode.maintenance_mode]
|
||||||
|
ask = "Enable maintenance mode"
|
||||||
|
type = "boolean"
|
||||||
|
default = "0"
|
||||||
|
|
||||||
[main.php_fpm_config]
|
[main.php_fpm_config]
|
||||||
name = "PHP-FPM configuration"
|
name = "PHP-FPM configuration"
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,16 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
get__maintenance_mode() {
|
||||||
|
# Maintenance mode status
|
||||||
|
if [ -f $final_path/.maintenance ]
|
||||||
|
then
|
||||||
|
echo "1"
|
||||||
|
else
|
||||||
|
echo "0"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
get__fpm_footprint() {
|
get__fpm_footprint() {
|
||||||
# Free footprint value for php-fpm
|
# Free footprint value for php-fpm
|
||||||
# Check if current_fpm_footprint is an integer
|
# Check if current_fpm_footprint is an integer
|
||||||
|
@ -49,6 +59,20 @@ get__free_footprint() {
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
set__maintenance_mode() {
|
||||||
|
if [ "$maintenance_mode" -eq "1" ]; then
|
||||||
|
# If maintenance_mode was set to 1, enable maintenance mode
|
||||||
|
(cd "$final_path" && ynh_exec_as "$app" \
|
||||||
|
echo "Site under maintenance." > .maintenance)
|
||||||
|
ynh_print_info "Maintenance mode disabled"
|
||||||
|
elif [ "$maintenance_mode" -eq "0" ]; then
|
||||||
|
# If maintenance_mode was set to 0, disable maintenance mode
|
||||||
|
ynh_secure_remove --file=$final_path/.maintenance
|
||||||
|
ynh_print_info "Maintenance mode enabled"
|
||||||
|
fi
|
||||||
|
ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode"
|
||||||
|
}
|
||||||
|
|
||||||
set__fpm_footprint() {
|
set__fpm_footprint() {
|
||||||
if [ "$fpm_footprint" != "specific" ]
|
if [ "$fpm_footprint" != "specific" ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Reference in a new issue