mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
62 lines
2.3 KiB
Bash
62 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS
|
|
#=================================================
|
|
|
|
php_version=$(ynh_app_setting_get --key=php_version)
|
|
|
|
#=================================================
|
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
|
#=================================================
|
|
|
|
get__maintenance_mode() {
|
|
# Maintenance mode status
|
|
maintenance_mode_status="$(cd "$install_dir" && ynh_exec_as_app \
|
|
php${php_version} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode)" 2> /dev/null
|
|
if echo $maintenance_mode_status | grep -q "disabled"
|
|
then
|
|
echo "0"
|
|
elif echo $maintenance_mode_status | grep -q "enabled"
|
|
then
|
|
echo "1"
|
|
else
|
|
ynh_print_warn "Unexpected output from maintenance status check command."
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
get__system_addressbook_exposed() {
|
|
echo $(cd "$install_dir" && ynh_exec_as_app \
|
|
php${php_version} --define apc.enable_cli=1 occ config:app:get dav system_addressbook_exposed)
|
|
}
|
|
|
|
#=================================================
|
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
|
#=================================================
|
|
|
|
set__maintenance_mode() {
|
|
if [ "$maintenance_mode" -eq "0" ]; then
|
|
# If maintenance_mode was set to 0, disable maintenance mode
|
|
(cd "$install_dir" && ynh_exec_as_app \
|
|
php${php_version} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off)
|
|
ynh_print_info "Maintenance mode disabled"
|
|
elif [ "$maintenance_mode" -eq "1" ]; then
|
|
# If maintenance_mode was set to 1, enable maintenance mode
|
|
(cd "$install_dir" && ynh_exec_as_app \
|
|
php${php_version} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --on)
|
|
ynh_print_info "Maintenance mode enabled"
|
|
fi
|
|
ynh_app_setting_set --key=maintenance_mode --value="$maintenance_mode"
|
|
}
|
|
|
|
set__system_addressbook_exposed() {
|
|
(cd "$install_dir" && ynh_exec_as_app \
|
|
php${php_version} --define apc.enable_cli=1 occ config:app:set dav system_addressbook_exposed --value="$system_addressbook_exposed")
|
|
ynh_print_info "System addressbook is exposed: $system_addressbook_exposed"
|
|
}
|
|
|
|
ynh_app_config_run $1
|