diff --git a/conf/nginx.conf b/conf/nginx.conf index eae8d07..7fff0f9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,7 +19,7 @@ location __PATH__/ { fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_read_timeout 600; + fastcgi_read_timeout 1600; } # Include SSOWAT user panel. diff --git a/hooks/post_user_create b/hooks/post_user_create index 5a6ed86..65fa805 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,15 +1,18 @@ #!/bin/bash -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 install_dir) +# Extract the app name from the script name, which is supposed to be something like "50-app_id" + +app="$(basename "$0" | cut -d- -f 2-)" +install_dir=$(yunohost app setting "$app" install_dir) +phpversion=$(yunohost app setting "$app" phpversion) # member=__MEMBER__ - + # Sync users -if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then - echo ldap user update ok +if sudo "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then + echo "LDAP user update ok" else - echo ldap user update ended with error + echo "LDAP user update ended with error" fi - + # If YNH users should also be members, sync members # if [ $member -eq 1 ]; # then diff --git a/scripts/install b/scripts/install index e0f53bc..b36c7ec 100644 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,7 @@ ynh_app_setting_set --app="$app" --key="fpm_usage" --value="$fpm_usage" ynh_script_progression --message="Configuring $app's MySQL database..." --weight=1 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" +ynh_mysql_execute_as_root --database="$db_name" --sql="SET NAMES 'utf8' COLLATE 'utf8_general_ci'" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -67,6 +68,20 @@ ynh_add_nginx_config # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" +ynh_script_progression --message="Configuring LDAP" --weight=1 + +# Populate the LDAP parameters +ynh_mysql_execute_file_as_root --database="$db_name" --file="../conf/sql/ldap.sql" + +# Populate the database with YNH users. +ynh_mysql_execute_file_as_root --database="$db_name" --file="../conf/sql/ldap_user.sql" + +if "php$phpversion" "$install_dir/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 + #================================================= # END OF SCRIPT #=================================================