diff --git a/scripts/install b/scripts/install index 345d103..dd3d372 100644 --- a/scripts/install +++ b/scripts/install @@ -63,6 +63,8 @@ db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -149,6 +151,9 @@ ynh_permission_update --permission="main" --add="visitors" ynh_systemd_action --service_name=nginx --action=reload # Installation with curl + +mkdir -p /var/log/$app/ + ynh_script_progression --message="Finalizing installation..." --weight=1 ynh_script_progression --message="Generate fileconf" --weight=1 @@ -158,17 +163,17 @@ ynh_local_curl "/install/fileconf.php" \ ynh_script_progression --message="installation - step 1" --weight=3 ynh_local_curl "/install/step1.php" \ "testpost=ok" \ - "action=set" + "action=set" > /var/log/$app/insatall1.html ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 ynh_local_curl "/install/step2.php" \ "testpost=ok" \ - "action=set" + "action=set" > /var/log/$app/insatall2.html ynh_script_progression --message="installation - step 4" --weight=3 ynh_local_curl "/install/step4.php" \ "testpost=ok" \ - "action=set" + "action=set" > /var/log/$app/insatall3.html # Generate a random password for the admin user (will be ignored because of LDAP) password=$(ynh_string_random 8) @@ -178,7 +183,7 @@ ynh_local_curl "/install/step5.php" \ "testpost=ok" \ "action=set" \ "pass=$password" \ - "pass_verif=$password" + "pass_verif=$password" > /var/log/$app/insatall4.html ynh_script_progression --message="configuring LDAP" --weight=1 diff --git a/scripts/upgrade b/scripts/upgrade index 402149e..cd3d349 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -169,19 +169,36 @@ then fi mkdir -p /var/log/$app/ - + # Upgrade with CURL + + # Set the app as temporarily public for cURL call + ynh_permission_update --permission="main" --add="visitors" + pushd $final_path/htdocs/install/ if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then ynh_print_info --message="Step 1 upgrading ended successfully" else ynh_print_warn --message="Step 1 upgrading ended with error" fi + if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then ynh_print_info --message="Step 2 upgrading ended successfully" else ynh_print_warn --message="Step 2 upgrading ended with error" fi + + charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'") + if [ "$charset" != "utf8" ] + then + ynh_script_progression --message="Changing Database charset to utf8" --weight=5 + + ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8" + + ynh_local_curl "/install/repair.php" \ + "force_utf8_on_tables=confirmed" > /var/log/$app/repair.html + fi + if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then ynh_print_info --message="Step 3 upgrading ended successfully" else @@ -191,6 +208,12 @@ then ynh_app_setting_set --app=$app --key=version --value=$update_version popd + + if [ $is_public -eq 0 ] + then + ynh_permission_update --permission="main" --remove="visitors" + fi + fi #=================================================