From 0e8f9287badef5b8d4f4353c1c654840c66b6f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 18 Dec 2020 11:48:45 +0100 Subject: [PATCH] Fix upgrade with password too short --- scripts/upgrade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 861ef79..6594744 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,6 +186,14 @@ ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string= ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_USER__" --replace_string="$ldap_user" ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" +# Check for admin password being too short for the new mediawiki requirements +password_length=$(ynh_app_setting_get --app="$app" --key=admin_password | awk '{print length}') +if (( password_length < 10 )); then + ynh_print_warn -m "The current admin password is $password_length long. Mediawiki now requires a 10 chars minimum password." + ynh_print_warn -m "We are adapting the minimum length, but that would be great to change the admin password." + echo '$wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = 10;' >> "$final_path/LocalSettings.php" +fi + "php$phpversion" "$final_path/maintenance/update.php" #=================================================