1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dolibarr_ynh.git synced 2024-09-03 18:35:53 +02:00

Change database to UTF8 #59

Add install app log
This commit is contained in:
mastereur 2021-07-12 18:16:15 +02:00
parent b93dcd144b
commit a9a2f48faa
2 changed files with 33 additions and 5 deletions

View file

@ -63,6 +63,8 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$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_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 # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -149,6 +151,9 @@ ynh_permission_update --permission="main" --add="visitors"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl # Installation with curl
mkdir -p /var/log/$app/
ynh_script_progression --message="Finalizing installation..." --weight=1 ynh_script_progression --message="Finalizing installation..." --weight=1
ynh_script_progression --message="Generate fileconf" --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_script_progression --message="installation - step 1" --weight=3
ynh_local_curl "/install/step1.php" \ ynh_local_curl "/install/step1.php" \
"testpost=ok" \ "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_script_progression --message="installation - step 2 (may take a while)..." --weight=72
ynh_local_curl "/install/step2.php" \ ynh_local_curl "/install/step2.php" \
"testpost=ok" \ "testpost=ok" \
"action=set" "action=set" > /var/log/$app/insatall2.html
ynh_script_progression --message="installation - step 4" --weight=3 ynh_script_progression --message="installation - step 4" --weight=3
ynh_local_curl "/install/step4.php" \ ynh_local_curl "/install/step4.php" \
"testpost=ok" \ "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) # Generate a random password for the admin user (will be ignored because of LDAP)
password=$(ynh_string_random 8) password=$(ynh_string_random 8)
@ -178,7 +183,7 @@ ynh_local_curl "/install/step5.php" \
"testpost=ok" \ "testpost=ok" \
"action=set" \ "action=set" \
"pass=$password" \ "pass=$password" \
"pass_verif=$password" "pass_verif=$password" > /var/log/$app/insatall4.html
ynh_script_progression --message="configuring LDAP" --weight=1 ynh_script_progression --message="configuring LDAP" --weight=1

View file

@ -171,17 +171,34 @@ then
mkdir -p /var/log/$app/ mkdir -p /var/log/$app/
# Upgrade with CURL # Upgrade with CURL
# Set the app as temporarily public for cURL call
ynh_permission_update --permission="main" --add="visitors"
pushd $final_path/htdocs/install/ pushd $final_path/htdocs/install/
if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then
ynh_print_info --message="Step 1 upgrading ended successfully" ynh_print_info --message="Step 1 upgrading ended successfully"
else else
ynh_print_warn --message="Step 1 upgrading ended with error" ynh_print_warn --message="Step 1 upgrading ended with error"
fi fi
if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then
ynh_print_info --message="Step 2 upgrading ended successfully" ynh_print_info --message="Step 2 upgrading ended successfully"
else else
ynh_print_warn --message="Step 2 upgrading ended with error" ynh_print_warn --message="Step 2 upgrading ended with error"
fi 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 if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then
ynh_print_info --message="Step 3 upgrading ended successfully" ynh_print_info --message="Step 3 upgrading ended successfully"
else else
@ -191,6 +208,12 @@ then
ynh_app_setting_set --app=$app --key=version --value=$update_version ynh_app_setting_set --app=$app --key=version --value=$update_version
popd popd
if [ $is_public -eq 0 ]
then
ynh_permission_update --permission="main" --remove="visitors"
fi
fi fi
#================================================= #=================================================