1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garradin_ynh.git synced 2024-09-03 18:36:17 +02:00

Update scripts/upgrade

simplify temporally enable visitors for curl if needed

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
Robles Rodolphe 2021-11-03 18:42:27 +01:00 committed by GitHub
parent 0e6e4467cf
commit b212b16214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,26 +107,19 @@ then
chown -R $app:$app $final_path
chmod 755 $final_path
# Create the visitors permission if needed
visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo 0 || echo 1)
if [[ $visitors_enabled -eq 1 ]]; then
# Temporarily enable visitors for curl if needed
visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no)
if [[ $visitors_enabled == "no" ]]; then
ynh_permission_update --permission "main" --add "visitors"
ynh_systemd_action --service_name=nginx --action=reload
# Finalize the upgrade
ynh_local_curl "/index.php"
sleep 5
ynh_local_curl "/index.php"
upgrade_type="UPGRADE_APP"
ynh_permission_update --permission "main" --remove "visitors"
fi
fi
if [[ $visitors_enabled -eq 0 ]]; then
ynh_systemd_action --service_name=nginx --action=reload
# Finalize the upgrade
ynh_local_curl "/index.php"
sleep 5
ynh_local_curl "/index.php"
upgrade_type="UPGRADE_APP"
# Finalize the upgrade
ynh_local_curl "/index.php"
sleep 5
ynh_local_curl "/index.php"
if [[ $visitors_enabled == "no" ]]; then
ynh_permission_update --permission "main" --remove "visitors"
fi
fi
#=================================================