From b4f0edce7c443735dc825c044507a1f327ab42cf Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:44:04 +0100 Subject: [PATCH] set version upgrade to the last one optimize hook --- hooks/post_user_create | 8 ++++---- scripts/install | 8 -------- scripts/upgrade | 6 ++++++ scripts/upgrade.d/upgrade.15.sh | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index f25b005..bd9cbd2 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,10 +1,10 @@ #!/bin/bash -app=__APP__ -src_path=__FINALPATH__ +app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id" +src_path=$(yunohost app setting $app final_path) # member=__MEMBER__ # Sync users -if sudo php $src_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then +if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then echo ldap user update ok else echo ldap user update ended with error @@ -13,7 +13,7 @@ fi # If YNH users should also be members, sync members # if [ $member -eq 1 ]; # then - # if sudo php $src_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then + # if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then # echo ldap member update ok # else # echo ldap member update ended with error diff --git a/scripts/install b/scripts/install index b67eb56..7ebde47 100644 --- a/scripts/install +++ b/scripts/install @@ -227,14 +227,6 @@ ynh_permission_update --permission="main" --remove="visitors" ynh_script_progression --message="configuring config file" --weight=1 ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$final_path/htdocs/conf/conf.php" -#================================================= -# CONFIGURE THE HOOK FILE FOR USER CREATE -#================================================= -fhook=../hooks/post_user_create -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook" -#ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook" - #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b825249..cdd5f58 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -274,6 +274,12 @@ EOF done + if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then + ynh_print_info --message="LDAP user update ok" + else + ynh_print_info --message="LDAP user update ended with error" + fi + ynh_app_setting_set --app=$app --key=version --value=$update_version fi diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh index d3ff37a..67585b6 100644 --- a/scripts/upgrade.d/upgrade.15.sh +++ b/scripts/upgrade.d/upgrade.15.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="16.0.0" +next_version="16.0.3" # Dolibarr tarball checksum -dolibarr_source_sha256="76a642d74cd3e4fe86fdeccffacd0fa2b22a398dc03e7ad92edb34d033b17b2f" \ No newline at end of file +dolibarr_source_sha256="52010375412c780b378145633a4e18abf6bde4c8e89a4cc1ad56d98fcd6120fd" \ No newline at end of file