From 32e1b9e8d740805e639c36724d3afc4136e08f26 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 13 Mar 2024 02:31:21 +0100 Subject: [PATCH 1/3] Upgrade to v1.10.5 https://code.castopod.org/adaures/castopod/-/releases/v1.10.5 --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 0b1894d..e683463 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Castopod" description.en = "Hosting platform made for podcasters" description.fr = "Plateforme d'hébergement conçue pour les podcasteurs" -version = "1.10.4~ynh1" +version = "1.10.5~ynh1" maintainers = ["orhtej2"] @@ -42,8 +42,8 @@ ram.runtime = "50M" [resources.sources] [resources.sources.main] - url = "https://code.castopod.org/adaures/castopod/uploads/c620846036e22029527407be58f29b8b/castopod-1.10.4.zip" - sha256 = "435c8886fe87639ca15b03bc168f519988a9cae60830f77f75d43a088db20ad5" + url = "https://code.castopod.org/adaures/castopod/uploads/194cc599dfcebbdc68e219c00dd0b6ac/castopod-1.10.5.zip" + sha256 = "8a716677ecc10ce4f8be9f58cd146afed0b90a795322748b917cd3b31d9ee542" autoupdate.strategy = "latest_gitlab_release" autoupdate.asset = "Castopod Package \\(zip\\)" in_subdir = true From 9f685a910072e7b1d888cf85aa1b009d3adc4381 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Wed, 13 Mar 2024 22:02:00 +0100 Subject: [PATCH 2/3] Run SQL migrations for v1.10.5 --- conf/sql/v1.10.5.sql | 2 + scripts/upgrade | 284 ++++++++++++++++++++++--------------------- 2 files changed, 146 insertions(+), 140 deletions(-) create mode 100644 conf/sql/v1.10.5.sql diff --git a/conf/sql/v1.10.5.sql b/conf/sql/v1.10.5.sql new file mode 100644 index 0000000..135c435 --- /dev/null +++ b/conf/sql/v1.10.5.sql @@ -0,0 +1,2 @@ +INSERT INTO `cp_platforms` (`slug`, `type`, `label`, `home_url`, `submit_url`) VALUES +('bluesky', 'social', 'Bluesky', 'https://bsky.app/', 'https://bsky.app/'); diff --git a/scripts/upgrade b/scripts/upgrade index f68d25d..5f5bfce 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,140 +1,144 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source _common.sh -source /usr/share/yunohost/helpers - -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "${fpm_free_footprint:-}" ]; then - fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "${fpm_usage:-}" ]; then - fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage -fi - -# If redis_db doesn't exist, create it -if [ -z "${redis_db:-}" ]; then - # Configure redis - redis_db=$(ynh_redis_get_free_db) - ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -fi - -#================================================= -# MOVE DATA TO __DATA_DIR__ -#================================================= - -if ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2"; then - ynh_script_progression --message="Moving data..." --weight=3 - mkdir -p $data_dir/media - cp -rf $install_dir/public/media/* $data_dir/media - chmod -R 750 $data_dir - chown -R $app:www-data $data_dir - - ynh_secure_remove --file="$install_dir/public/media" - - ynh_script_progression --message="Fixing migrations..." --weight=1 - # this will fail is `cp-install` was not run on prev version - just ignore, DB schema is (re)generated later. - ynh_mysql_execute_as_root --database=$db_name --sql="UPDATE cp_migrations SET class='Media\\\\Database\\\\Migrations\\\\AddMedia', namespace='Media' where class='App\\\\Database\\\\Migrations\\\\AddMedia'" || true -elif ynh_compare_current_package_version --comparison lt --version "1.6.5~ynh2"; then - chown -R $app:www-data $data_dir -fi - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -# 1.7.1~ynh2 accidently shipped 1.6.5, force upgrade on that version even if it's theoretically the same upstream release - -if [ "$upgrade_type" == "UPGRADE_APP" ] || ynh_compare_current_package_version --comparison eq --version "1.7.1~ynh2" -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 -fi - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -#================================================= -# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint - -# Create a dedicated NGINX config -ynh_add_nginx_config - -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - -#================================================= -# CONFIGURE CASTOPOD -#================================================= -ynh_script_progression --message="Configuring $app..." --weight=1 - -ynh_add_config --template=".env.example" --destination="$install_dir/.env" -chmod 600 $install_dir/.env -chown $app:www-data "$install_dir/.env" - -#================================================= -# RUN MIGRATIONS -#================================================= -ynh_script_progression --message="Configuring $app database..." --weight=1 - -pushd $install_dir - ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear - ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update -popd - -if ynh_compare_current_package_version --comparison le --version "1.6.5~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.5.2 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.5.2.sql" - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.6.1 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.6.1.sql" -fi -if ynh_compare_current_package_version --comparison lt --version "1.7.3~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.7.3 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.7.3.sql" -fi -if ynh_compare_current_package_version --comparison lt --version "1.8.2~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.7.3 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.8.0.sql" -fi - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Upgrade of $app completed" --last +#!/bin/bash + +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If fpm_footprint doesn't exist, create it +if [ -z "${fpm_footprint:-}" ]; then + fpm_footprint=low + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +fi + +# If fpm_free_footprint doesn't exist, create it +if [ -z "${fpm_free_footprint:-}" ]; then + fpm_free_footprint=0 + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +fi + +# If fpm_usage doesn't exist, create it +if [ -z "${fpm_usage:-}" ]; then + fpm_usage=low + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +fi + +# If redis_db doesn't exist, create it +if [ -z "${redis_db:-}" ]; then + # Configure redis + redis_db=$(ynh_redis_get_free_db) + ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" +fi + +#================================================= +# MOVE DATA TO __DATA_DIR__ +#================================================= + +if ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2"; then + ynh_script_progression --message="Moving data..." --weight=3 + mkdir -p $data_dir/media + cp -rf $install_dir/public/media/* $data_dir/media + chmod -R 750 $data_dir + chown -R $app:www-data $data_dir + + ynh_secure_remove --file="$install_dir/public/media" + + ynh_script_progression --message="Fixing migrations..." --weight=1 + # this will fail is `cp-install` was not run on prev version - just ignore, DB schema is (re)generated later. + ynh_mysql_execute_as_root --database=$db_name --sql="UPDATE cp_migrations SET class='Media\\\\Database\\\\Migrations\\\\AddMedia', namespace='Media' where class='App\\\\Database\\\\Migrations\\\\AddMedia'" || true +elif ynh_compare_current_package_version --comparison lt --version "1.6.5~ynh2"; then + chown -R $app:www-data $data_dir +fi + +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +# 1.7.1~ynh2 accidently shipped 1.6.5, force upgrade on that version even if it's theoretically the same upstream release + +if [ "$upgrade_type" == "UPGRADE_APP" ] || ynh_compare_current_package_version --comparison eq --version "1.7.1~ynh2" +then + ynh_script_progression --message="Upgrading source files..." --weight=1 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 +fi + +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + +# Create a dedicated NGINX config +ynh_add_nginx_config + +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + +#================================================= +# CONFIGURE CASTOPOD +#================================================= +ynh_script_progression --message="Configuring $app..." --weight=1 + +ynh_add_config --template=".env.example" --destination="$install_dir/.env" +chmod 600 $install_dir/.env +chown $app:www-data "$install_dir/.env" + +#================================================= +# RUN MIGRATIONS +#================================================= +ynh_script_progression --message="Configuring $app database..." --weight=1 + +pushd $install_dir + ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear + ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update +popd + +if ynh_compare_current_package_version --comparison le --version "1.6.5~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.5.2 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.5.2.sql" + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.6.1 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.6.1.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.7.3~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.7.3 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.7.3.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.8.2~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.8.2 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.8.0.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.10.5~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.10.5 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.10.5.sql" +fi + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Upgrade of $app completed" --last From aca2aa270f5a19e60730b34a8a7619e2b7f1b6cd Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Wed, 13 Mar 2024 22:03:03 +0100 Subject: [PATCH 3/3] Fix line endings --- scripts/upgrade | 288 ++++++++++++++++++++++++------------------------ 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5f5bfce..7e18af8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,144 +1,144 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source _common.sh -source /usr/share/yunohost/helpers - -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "${fpm_free_footprint:-}" ]; then - fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "${fpm_usage:-}" ]; then - fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage -fi - -# If redis_db doesn't exist, create it -if [ -z "${redis_db:-}" ]; then - # Configure redis - redis_db=$(ynh_redis_get_free_db) - ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -fi - -#================================================= -# MOVE DATA TO __DATA_DIR__ -#================================================= - -if ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2"; then - ynh_script_progression --message="Moving data..." --weight=3 - mkdir -p $data_dir/media - cp -rf $install_dir/public/media/* $data_dir/media - chmod -R 750 $data_dir - chown -R $app:www-data $data_dir - - ynh_secure_remove --file="$install_dir/public/media" - - ynh_script_progression --message="Fixing migrations..." --weight=1 - # this will fail is `cp-install` was not run on prev version - just ignore, DB schema is (re)generated later. - ynh_mysql_execute_as_root --database=$db_name --sql="UPDATE cp_migrations SET class='Media\\\\Database\\\\Migrations\\\\AddMedia', namespace='Media' where class='App\\\\Database\\\\Migrations\\\\AddMedia'" || true -elif ynh_compare_current_package_version --comparison lt --version "1.6.5~ynh2"; then - chown -R $app:www-data $data_dir -fi - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -# 1.7.1~ynh2 accidently shipped 1.6.5, force upgrade on that version even if it's theoretically the same upstream release - -if [ "$upgrade_type" == "UPGRADE_APP" ] || ynh_compare_current_package_version --comparison eq --version "1.7.1~ynh2" -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 -fi - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -#================================================= -# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint - -# Create a dedicated NGINX config -ynh_add_nginx_config - -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - -#================================================= -# CONFIGURE CASTOPOD -#================================================= -ynh_script_progression --message="Configuring $app..." --weight=1 - -ynh_add_config --template=".env.example" --destination="$install_dir/.env" -chmod 600 $install_dir/.env -chown $app:www-data "$install_dir/.env" - -#================================================= -# RUN MIGRATIONS -#================================================= -ynh_script_progression --message="Configuring $app database..." --weight=1 - -pushd $install_dir - ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear - ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update -popd - -if ynh_compare_current_package_version --comparison le --version "1.6.5~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.5.2 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.5.2.sql" - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.6.1 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.6.1.sql" -fi -if ynh_compare_current_package_version --comparison lt --version "1.7.3~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.7.3 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.7.3.sql" -fi -if ynh_compare_current_package_version --comparison lt --version "1.8.2~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.8.2 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.8.0.sql" -fi -if ynh_compare_current_package_version --comparison lt --version "1.10.5~ynh1"; then - # cf https://code.castopod.org/adaures/castopod/-/releases/v1.10.5 - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.10.5.sql" -fi - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Upgrade of $app completed" --last +#!/bin/bash + +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If fpm_footprint doesn't exist, create it +if [ -z "${fpm_footprint:-}" ]; then + fpm_footprint=low + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +fi + +# If fpm_free_footprint doesn't exist, create it +if [ -z "${fpm_free_footprint:-}" ]; then + fpm_free_footprint=0 + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +fi + +# If fpm_usage doesn't exist, create it +if [ -z "${fpm_usage:-}" ]; then + fpm_usage=low + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +fi + +# If redis_db doesn't exist, create it +if [ -z "${redis_db:-}" ]; then + # Configure redis + redis_db=$(ynh_redis_get_free_db) + ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" +fi + +#================================================= +# MOVE DATA TO __DATA_DIR__ +#================================================= + +if ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2"; then + ynh_script_progression --message="Moving data..." --weight=3 + mkdir -p $data_dir/media + cp -rf $install_dir/public/media/* $data_dir/media + chmod -R 750 $data_dir + chown -R $app:www-data $data_dir + + ynh_secure_remove --file="$install_dir/public/media" + + ynh_script_progression --message="Fixing migrations..." --weight=1 + # this will fail is `cp-install` was not run on prev version - just ignore, DB schema is (re)generated later. + ynh_mysql_execute_as_root --database=$db_name --sql="UPDATE cp_migrations SET class='Media\\\\Database\\\\Migrations\\\\AddMedia', namespace='Media' where class='App\\\\Database\\\\Migrations\\\\AddMedia'" || true +elif ynh_compare_current_package_version --comparison lt --version "1.6.5~ynh2"; then + chown -R $app:www-data $data_dir +fi + +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +# 1.7.1~ynh2 accidently shipped 1.6.5, force upgrade on that version even if it's theoretically the same upstream release + +if [ "$upgrade_type" == "UPGRADE_APP" ] || ynh_compare_current_package_version --comparison eq --version "1.7.1~ynh2" +then + ynh_script_progression --message="Upgrading source files..." --weight=1 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 +fi + +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + +# Create a dedicated NGINX config +ynh_add_nginx_config + +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + +#================================================= +# CONFIGURE CASTOPOD +#================================================= +ynh_script_progression --message="Configuring $app..." --weight=1 + +ynh_add_config --template=".env.example" --destination="$install_dir/.env" +chmod 600 $install_dir/.env +chown $app:www-data "$install_dir/.env" + +#================================================= +# RUN MIGRATIONS +#================================================= +ynh_script_progression --message="Configuring $app database..." --weight=1 + +pushd $install_dir + ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear + ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update +popd + +if ynh_compare_current_package_version --comparison le --version "1.6.5~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.5.2 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.5.2.sql" + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.6.1 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.6.1.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.7.3~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.7.3 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.7.3.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.8.2~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.8.2 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.8.0.sql" +fi +if ynh_compare_current_package_version --comparison lt --version "1.10.5~ynh1"; then + # cf https://code.castopod.org/adaures/castopod/-/releases/v1.10.5 + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.10.5.sql" +fi + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Upgrade of $app completed" --last