1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/spip_ynh.git synced 2024-09-03 20:25:59 +02:00

remove is_public

This commit is contained in:
Kay0u 2021-08-09 11:25:34 +02:00
parent 12667fd914
commit 93e29aa41a
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
2 changed files with 18 additions and 21 deletions

View file

@ -52,7 +52,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=users_status --value=$users_status
#=================================================
@ -122,7 +121,7 @@ ynh_permission_update --permission="main" --add="visitors"
# Installation with curl
ynh_script_progression --message="Finalizing installation..."
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
# For now spip have a problem with LDAP
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap1"

View file

@ -20,7 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
password=$(ynh_app_setting_get --app=$app --key=password)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
users_status=$(ynh_app_setting_get --app=$app --key=users_status)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -60,13 +59,10 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
# Remove is_public
if [ -n "$is_public" ]; then
ynh_app_setting_delete --app=$app --key=is_public
fi
# If db_name doesn't exist, create it
@ -170,8 +166,15 @@ chown -R $app:www-data "$final_path"
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..."
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
if ! ynh_permission_has_user --permission=main --user="visitors"; then
is_public=0
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
else
is_public=1
fi
ynh_backup_if_checksum_is_different --file="$final_path/config/connect.php"
@ -180,7 +183,7 @@ mv $final_path/config/connect.php $final_path/config/connect.php.ynh_bkp
# Installation with curl
ynh_script_progression --message="Finalizing installation..."
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
# For now spip have a problem with LDAP
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap1"
@ -206,9 +209,6 @@ email=$(yunohost user info $admin | grep mail: | cut -d' ' -f2 | tr -d '\n')
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=$email" "login=$admin" "pass=$password" "pass_verif=$password"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin"
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
@ -235,12 +235,10 @@ ynh_store_file_checksum --file="$final_path/config/connect.php"
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
# Make app private if necessary
if [ $is_public -eq 0 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
ynh_permission_update --permission="main" --remove="visitors"
fi
#=================================================