From 4e130d43e1fa5333e3bc34e9b4f955ca857f65d7 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Thu, 19 Mar 2020 11:36:41 +0100 Subject: [PATCH 1/3] fix upgrade --- scripts/upgrade | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8fc0cec..a8b798e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,13 +107,13 @@ then ynh_script_progression --message="Upgrading source files..." --weight=3 # Create tmp directory and fetch app inside - tmpdir="$(ynh_smart_mktemp --min_size=300)" - ynh_setup_source --dest_dir="$tmpdir" + tmpdir="$(ynh_smart_mktemp --min_size=300)" + ynh_setup_source --dest_dir="$tmpdir" - # Fetch needed plugins - mkdir -p $tmpdir/plugins/Ldap_Login - ynh_setup_source --dest_dir="$tmpdir/plugins/Ldap_Login" --source_id=ldap_plugin - ynh_setup_source --dest_dir="$tmpdir/plugins" --source_id=log_failed_logins_plugin + # Fetch needed plugins + mkdir -p $tmpdir/plugins/Ldap_Login + ynh_setup_source --dest_dir="$tmpdir/plugins/Ldap_Login" --source_id=ldap_plugin + ynh_setup_source --dest_dir="$tmpdir/plugins" --source_id=log_failed_logins_plugin fi #================================================= @@ -158,31 +158,34 @@ shopt -s extglob datapath=/home/yunohost.app/$app -# Install files and set permissions -cp -a $tmpdir/!(upload|_data|galleries) $final_path +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Install files and set permissions + cp -a $tmpdir/!(upload|_data|galleries) $final_path -# Backward compatibility: -# If the _data subdirectory wasn't already moved to /home/yunohost.app/$app, -# then move it there -if [ ! -h $final_path/_data ] ; then - mv $final_path/_data $datapath - ln -sd $datapath/_data $final_path/_data -fi + # Backward compatibility: + # If the _data subdirectory wasn't already moved to /home/yunohost.app/$app, + # then move it there + if [ ! -h $final_path/_data ] ; then + mv $final_path/_data $datapath + ln -sd $datapath/_data $final_path/_data + fi -# Backward compatibility: -# If the galleries subdirectory wasn't already moved to /home/yunohost.app/$app, -# then move it there -if [ ! -h $final_path/galleries ] ; then - mv $final_path/galleries $datapath - ln -sd $datapath/galleries $final_path/galleries + # Backward compatibility: + # If the galleries subdirectory wasn't already moved to /home/yunohost.app/$app, + # then move it there + if [ ! -h $final_path/galleries ] ; then + mv $final_path/galleries $datapath + ln -sd $datapath/galleries $final_path/galleries + fi + + ynh_secure_remove --file="$tmpdir" fi chown -R $app: $final_path chown -R $app: $datapath chmod 755 -R $final_path/_data -ynh_secure_remove --file="$tmpdir" - #================================================= # UPGRADE APPLICATION WITH CURL #================================================= From 8d4df673130a1b558aa0571618aa06e9a7a5c2a2 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 21 Mar 2020 09:48:28 +0100 Subject: [PATCH 2/3] Force app and plugin update for configuraton consistency --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index a8b798e..b5029ad 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,6 +31,9 @@ admin_pwd=$(ynh_app_setting_get --app=$app --key=admin_pwd) #================================================= upgrade_type=$(ynh_check_app_version_changed) +# Workaround for now to force all instances to get the latest LDAP plugin +# in order to create the dedicated tables +upgrade_type="UPGRADE_APP" #================================================= # ENSURE DOWNWARD COMPATIBILITY From 94916618c1ee843a4f20e3ba95b4bfd7bad0838c Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 28 Mar 2020 10:17:23 +0100 Subject: [PATCH 3/3] Workaround for warnings preventing successful WS API calls --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index b5029ad..348aa2d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -243,6 +243,9 @@ ynh_store_file_checksum --file="$final_path/local/config/database.inc.php" #================================================= ynh_script_progression --message="Configuring LDAP plugin..." +# Disable LDAP plugin to avoid warning messages during API call +ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "DELETE FROM plugins WHERE id='Ldap_Login';" + # Activate the LDAP plugin using the WS API # Login with admin account