From aafdc8060fa007a7c2e30677019f31f690610a8a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 8 Nov 2021 14:14:04 +0100 Subject: [PATCH 1/9] Fix ynh_composer_exec syntax --- scripts/install | 6 +++--- scripts/upgrade | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index f7192ec..0c13894 100644 --- a/scripts/install +++ b/scripts/install @@ -135,13 +135,13 @@ ynh_script_progression --message="Installing composer dependencies..." --weight= ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" # Set Flarum version -ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require flarum/core:$core_version --prefer-lowest --no-update\" +ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require flarum/core:$core_version --prefer-lowest --no-update" # Require LDAP extension -ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update\" +ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update" # Update and download dependencies -ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"update\" +ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="update" #================================================= # FLARUM POST-INSTALL diff --git a/scripts/upgrade b/scripts/upgrade index b74b3a9..d10315d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,7 +87,7 @@ fi # Remove SSOwat if it exists ssowat_extension=$(ynh_app_setting_get --app=$app --key=ssowat_extension) if [ ! -z "$ssowat_extension" ]; then - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"remove tituspijean/flarum-ext-auth-ssowat\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="remove tituspijean/flarum-ext-auth-ssowat" ynh_app_setting_delete --app=$app --key=ssowat_extension fi @@ -186,8 +186,8 @@ then # Perform migrations and clear cache pushd $final_path ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update\" - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies" ynh_exec_as $app php$phpversion flarum migrate ynh_exec_as $app php$phpversion flarum cache:clear popd @@ -210,14 +210,14 @@ fi case $language in fr) ynh_script_progression --message="Installing French extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require qiaeru/lang-french:^2.0.0\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require qiaeru/lang-french:^2.0.0" activate_flarum_extension $db_name "qiaeru-lang-french" sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name ;; de) ynh_script_progression --message="Installing German extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require kakifrucht/flarum-de:^1.0.0\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require kakifrucht/flarum-de:^1.0.0" activate_flarum_extension $db_name "kakifrucht-de" sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name From c17edbd66bafd35824554f569910df918dc04d17 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 8 Nov 2021 14:31:27 +0100 Subject: [PATCH 2/9] Bump yunohost requirement due to previous commit --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 73cdc5c..cc80e7f 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,7 @@ "email": "tituspijean@outlook.com" }, "requirements": { - "yunohost": ">= 4.2.0" + "yunohost": ">= 4.3.2" }, "multi_instance": true, "services": [ From 450821c6f1a9ddcf2dca9c01a3f89608ed5d4d18 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 11 Nov 2021 18:18:14 +0100 Subject: [PATCH 3/9] Fix ynh_composer_exec syntax, continued --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0c13894..d817c79 100644 --- a/scripts/install +++ b/scripts/install @@ -172,14 +172,14 @@ ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$db_name < ../c case $language in fr) ynh_script_progression --message="Installing French extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require qiaeru/lang-french:^2.0.0\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require qiaeru/lang-french:^2.0.0" activate_flarum_extension $db_name "qiaeru-lang-french" sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name ;; de) ynh_script_progression --message="Installing German extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require kakifrucht/flarum-de:^1.0.0\" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require kakifrucht/flarum-de:^1.0.0" activate_flarum_extension $db_name "kakifrucht-de" sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name From b6a29ea2bb4c3d2b5aa2dd786d12b72844e88929 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 11 Nov 2021 18:23:15 +0100 Subject: [PATCH 4/9] Remove password example in manifest --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index cc80e7f..f9c1114 100644 --- a/manifest.json +++ b/manifest.json @@ -60,8 +60,7 @@ "help": { "en": "Choose your password. It will be useful if logging in from YunoHost fails or is disrupted.", "fr": "Choisissez votre mot de passe. Il sera utile si la connexion via YunoHost échoue ou est perturbée." - }, - "example": "Choose a password" + } }, { "name": "title", From 8ca8a86713438ce26aed038e11ec7dca2865c977 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 11 Nov 2021 23:14:58 +0100 Subject: [PATCH 5/9] Upgrade to v1.1.1 --- manifest.json | 2 +- scripts/_common.sh | 4 ++-- scripts/install | 1 + scripts/upgrade | 13 ++++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index f9c1114..f65f256 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Forum de nouvelle génération, simplement", "de": "Forum der nächsten Generation leicht gemacht" }, - "version": "1.0.0~ynh6", + "version": "1.1.1~ynh1", "url": "http://flarum.org/", "upstream": { "license": "MIT", diff --git a/scripts/_common.sh b/scripts/_common.sh index ed6c97c..d00fdd1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,8 +14,8 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php # Version numbers project_version="~1.0.0" -core_version="~1.0.0" -ldap_version="~1.0.0-p1" +#core_version is now retrieved from the manifest +ldap_version="*" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index d817c79..53cea4a 100644 --- a/scripts/install +++ b/scripts/install @@ -31,6 +31,7 @@ admin_pwd=$YNH_APP_ARG_PASSWORD is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE title=$YNH_APP_ARG_TITLE +core_version=$(ynh_app_upstream_version) admin_mail=$(ynh_user_get_info --username=$admin --key=mail) diff --git a/scripts/upgrade b/scripts/upgrade index d10315d..8be6827 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,6 +26,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) old_project_version=$(ynh_app_setting_get --app=$app --key=project_version) old_core_version=$(ynh_app_setting_get --app=$app --key=core_version) +core_version=$(ynh_app_upstream_version) old_ldap_version=$(ynh_app_setting_get --app=$app --key=ldap_version) #================================================= @@ -84,7 +85,7 @@ if [ ! -z "$bazaar_extension" ]; then ynh_app_setting_delete --app=$app --key=bazaar_extension fi -# Remove SSOwat if it exists +# Remove SSOwat extension if it exists ssowat_extension=$(ynh_app_setting_get --app=$app --key=ssowat_extension) if [ ! -z "$ssowat_extension" ]; then ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="remove tituspijean/flarum-ext-auth-ssowat" @@ -183,6 +184,12 @@ then # Install Composer and Flarum ynh_exec_warn_less ynh_install_composer --phpversion=$phpversion --workdir=$final_path + if [ ynh_compare_current_package_version --comparison lt --version 1.1.0~ynh1 ]; then + # Starting 1.0 (implemented for 1.1 in the package), version requirement is "*" for extensions + # ... except for flarum/core, but that's handled in the next block. + jq '.require | .[] = "*"' $final_path/composer.json + fi + # Perform migrations and clear cache pushd $final_path ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1 @@ -210,14 +217,14 @@ fi case $language in fr) ynh_script_progression --message="Installing French extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require qiaeru/lang-french:^2.0.0" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require qiaeru/lang-french:*" activate_flarum_extension $db_name "qiaeru-lang-french" sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name ;; de) ynh_script_progression --message="Installing German extension..." --weight=2 - ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require kakifrucht/flarum-de:^1.0.0" + ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands="require kakifrucht/flarum-de:*" activate_flarum_extension $db_name "kakifrucht-de" sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'" ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name From 123ad37ee31265cf06b85d8dd15ff82704631459 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 11 Nov 2021 22:15:17 +0000 Subject: [PATCH 6/9] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f816011..0b530e4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Flarum is a simple discussion platform for your website. It's fast and easy to use, with all the features you need to run a successful community. -**Shipped version:** 1.0.0~ynh6 +**Shipped version:** 1.1.1~ynh1 **Demo:** https://discuss.flarum.org/d/21101-demos-come-to-flarum diff --git a/README_fr.md b/README_fr.md index 763ce5f..5eda6e0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Flarum est une plate-forme de discussion simple pour votre site Web. C'est rapide et facile à utiliser, avec toutes les fonctionnalités dont vous avez besoin pour gérer une communauté. -**Version incluse :** 1.0.0~ynh6 +**Version incluse :** 1.1.1~ynh1 **Démo :** https://discuss.flarum.org/d/21101-demos-come-to-flarum From 3517741eb33546ded316c3b4364fc5d4b919d592 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 12 Nov 2021 00:19:47 +0100 Subject: [PATCH 7/9] Fix detection of upgrade to >=1.1 --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8be6827..e8bea36 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -184,7 +184,8 @@ then # Install Composer and Flarum ynh_exec_warn_less ynh_install_composer --phpversion=$phpversion --workdir=$final_path - if [ ynh_compare_current_package_version --comparison lt --version 1.1.0~ynh1 ]; then + if ynh_compare_current_package_version --comparison lt --version 1.1.0~ynh1 + then # Starting 1.0 (implemented for 1.1 in the package), version requirement is "*" for extensions # ... except for flarum/core, but that's handled in the next block. jq '.require | .[] = "*"' $final_path/composer.json From c54f6400cc0e8f10929711e1f9363ccbdfe219e7 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 12 Nov 2021 00:20:35 +0100 Subject: [PATCH 8/9] Update check_process --- check_process | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_process b/check_process index d0db53f..c16f42e 100644 --- a/check_process +++ b/check_process @@ -19,6 +19,7 @@ # upgrade=1 from_commit=0d30809a2903544a660635f62a25bc6057ea2f15 # upgrade=1 from_commit=0175b7a3b0a551e14f39c65290d194ccc71cd6ee # upgrade=1 from_commit=70e962faa875070b0fcc29f45cc70e2a51de76a6 + upgrade=1 from_commit=b6a29ea2bb4c3d2b5aa2dd786d12b72844e88929 backup_restore=1 multi_instance=1 port_already_use=0 @@ -36,3 +37,6 @@ Notification=none ; commit=70e962faa875070b0fcc29f45cc70e2a51de76a6 name=2021-05-06 0.1.0.16~ynh2 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=PASSWORD&language=fr&is_public=1&title=Forum& + ; commit=b6a29ea2bb4c3d2b5aa2dd786d12b72844e88929 + name=2021-11-12 fixed 1.0 + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=PASSWORD&language=fr&is_public=1&title=Forum& From 79048640b23e7b249d6b19c65da793e2ca6d9c87 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 12 Nov 2021 09:33:47 +0100 Subject: [PATCH 9/9] Use quotes while storing string settings --- scripts/install | 14 +++++++------- scripts/upgrade | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 53cea4a..3f1ecd5 100644 --- a/scripts/install +++ b/scripts/install @@ -53,13 +53,13 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=language --value=$language -ynh_app_setting_set --app=$app --key=project_version --value=$project_version -ynh_app_setting_set --app=$app --key=core_version --value=$core_version -ynh_app_setting_set --app=$app --key=ldap_version --value=$ldap_version +ynh_app_setting_set --app=$app --key=domain --value="$domain" +ynh_app_setting_set --app=$app --key=path --value="$path_url" +ynh_app_setting_set --app=$app --key=admin --value="$admin" +ynh_app_setting_set --app=$app --key=language --value="$language" +ynh_app_setting_set --app=$app --key=project_version --value="$project_version" +ynh_app_setting_set --app=$app --key=core_version --value="$core_version" +ynh_app_setting_set --app=$app --key=ldap_version --value="$ldap_version" #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index e8bea36..8e0072c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -240,9 +240,9 @@ pushd $final_path popd # Save version settings -ynh_app_setting_set $app project_version $project_version -ynh_app_setting_set $app core_version $core_version -ynh_app_setting_set $app ldap_version $ldap_version +ynh_app_setting_set $app project_version "$project_version" +ynh_app_setting_set $app core_version "$core_version" +ynh_app_setting_set $app ldap_version "$ldap_version" #================================================= # GENERIC FINALIZATION