From 9eb5d75769b2fc60bfac852c9791b8e24d4cb99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 13:21:59 +0100 Subject: [PATCH 1/5] Use ynh_add_config for parameters.yml instead of modifying the source file --- conf/parameters.yml | 69 +++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 14 ++------- scripts/upgrade | 13 ++------- 3 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 conf/parameters.yml diff --git a/conf/parameters.yml b/conf/parameters.yml new file mode 100644 index 0000000..5b5f803 --- /dev/null +++ b/conf/parameters.yml @@ -0,0 +1,69 @@ +# This file is a "template" of what your parameters.yml file should look like +parameters: + # Uncomment these settings or manually update your parameters.yml + # to use docker-compose + # + # database_driver: %env.database_driver% + # database_host: %env.database_host% + # database_port: %env.database_port% + # database_name: %env.database_name% + # database_user: %env.database_user% + # database_password: %env.database_password% + + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: ~ + database_name: __DB_NAME__ + database_user: __DB_USER__ + database_password: __DB_PWD__ + # For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite" + database_path: null + database_table_prefix: null + database_socket: null + # with PostgreSQL and SQLite, you must set "utf8" + database_charset: utf8mb4 + + domain_name: https://__DOMAIN____PATH__ + server_name: "Your wallabag instance" + + #mailer_dsn: smtp://user:pass@__DOMAIN__:25 + mailer_dsn: sendmail://default + + locale: en + + # A secret key that's used to generate certain security-related tokens + secret: __DESKEY__ + + # two factor stuff + twofactor_auth: true + twofactor_sender: no-reply@wallabag.org + + # fosuser stuff + fosuser_registration: false + fosuser_confirmation: true + + # how long the access token should live in seconds for the API + fos_oauth_server_access_token_lifetime: 3600 + # how long the refresh token should life in seconds for the API + fos_oauth_server_refresh_token_lifetime: 1209600 + + from_email: no-reply@wallabag.org + + rss_limit: 50 + + # RabbitMQ processing + rabbitmq_host: localhost + rabbitmq_port: 5672 + rabbitmq_user: guest + rabbitmq_password: guest + rabbitmq_prefetch_count: 10 + + # Redis processing + redis_scheme: tcp + redis_host: localhost + redis_port: 6379 + redis_path: null + redis_password: null + + # sentry logging + sentry_dsn: ~ diff --git a/scripts/install b/scripts/install index 21f3764..c8914fd 100644 --- a/scripts/install +++ b/scripts/install @@ -40,19 +40,9 @@ fi #================================================= ynh_script_progression --message="Adding $app's configuration files..." --weight=1 -# Copy and set Wallabag dist configuration -cp "$install_dir/app/config/parameters.yml.dist" "$wb_conf" - -ynh_replace_string --target_file="$wb_conf" --match_string="fosuser_registration: true" --replace_string="fosuser_registration: false" -ynh_replace_string --target_file="$wb_conf" --match_string="database_name: wallabag" --replace_string="database_name: $db_name" -ynh_replace_string --target_file="$wb_conf" --match_string="database_user: root" --replace_string="database_user: $db_user" -ynh_replace_string --target_file="$wb_conf" --match_string="database_password: ~" --replace_string="database_password: $db_pwd" -ynh_replace_string --target_file="$wb_conf" --match_string="database_table_prefix: wallabag_" --replace_string="database_table_prefix: null" -ynh_replace_string --target_file="$wb_conf" --match_string="secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" --replace_string="secret: $deskey" -ynh_replace_string --target_file="$wb_conf" --match_string="domain_name: https://your-wallabag-url-instance.com" --replace_string="domain_name: https://$domain$path" - +ynh_add_config --template="parameters.yml" --destination="$wb_conf" chmod 600 "$wb_conf" -chown -R "$app:www-data" "$install_dir" +chown "$app:www-data" "$wb_conf" # Alias for php-cli execution command php_exec=("php$phpversion" "$install_dir/bin/console" --no-interaction --env=prod) diff --git a/scripts/upgrade b/scripts/upgrade index c1a989b..ac579c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,18 +38,9 @@ fi ynh_script_progression --message="Reconfiguring $app..." --weight=1 # Copy and set Wallabag dist configuration -cp "$install_dir/app/config/parameters.yml.dist" "$wb_conf" - -ynh_replace_string --target_file="$wb_conf" --match_string="fosuser_registration: true" --replace_string="fosuser_registration: false" -ynh_replace_string --target_file="$wb_conf" --match_string="database_name: wallabag" --replace_string="database_name: $db_name" -ynh_replace_string --target_file="$wb_conf" --match_string="database_user: root" --replace_string="database_user: $db_user" -ynh_replace_string --target_file="$wb_conf" --match_string="database_password: ~" --replace_string="database_password: $db_pwd" -ynh_replace_string --target_file="$wb_conf" --match_string="database_table_prefix: wallabag_" --replace_string="database_table_prefix: null" -ynh_replace_string --target_file="$wb_conf" --match_string="secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" --replace_string="secret: $deskey" -ynh_replace_string --target_file="$wb_conf" --match_string="domain_name: https://your-wallabag-url-instance.com" --replace_string="domain_name: https://$domain$path" - +ynh_add_config --template="parameters.yml" --destination="$wb_conf" chmod 600 "$wb_conf" -chown -R "$app:www-data" "$install_dir" +chown "$app:www-data" "$wb_conf" # Alias for php-cli execution command php_exec=("php$phpversion" "$install_dir/bin/console" --no-interaction --env=prod) From 48e09178996fbea71f53fa0230461bac8808f039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 13:22:48 +0100 Subject: [PATCH 2/5] Add foreign-keys-removal.sql for database migration --- conf/foreign-keys-removal.sql | 12 ++++++++++++ scripts/upgrade | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 conf/foreign-keys-removal.sql diff --git a/conf/foreign-keys-removal.sql b/conf/foreign-keys-removal.sql new file mode 100644 index 0000000..0ebad2c --- /dev/null +++ b/conf/foreign-keys-removal.sql @@ -0,0 +1,12 @@ +# Drop old foreign keys + +ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_D247A21BA76ED395; +ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_D247A21B19EB6921; +ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_A018A10DA76ED395; +ALTER TABLE `oauth2_clients` DROP FOREIGN KEY IF EXISTS FK_F9D02AE6A76ED395; +ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_D394478CA76ED395; +ALTER TABLE `config` DROP FOREIGN KEY IF EXISTS FK_D48A2F7CA76ED395; +ALTER TABLE `entry` DROP FOREIGN KEY IF EXISTS FK_2B219D70A76ED395; +ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_A018A10D19EB6921; +ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_D394478C19EB6921; +ALTER TABLE `tagging_rule` DROP FOREIGN KEY IF EXISTS FK_1AF95E7824DB0683; diff --git a/scripts/upgrade b/scripts/upgrade index ac579c1..c0a2b54 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,7 +10,15 @@ source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -# ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +if ynh_compare_current_package_version --comparison lt --version "2.4~ynh1"; then + # Migrate old (erroneous) database scheme (see: https://github.com/YunoHost-Apps/wallabag2_ynh/pull/125#issuecomment-1041426972) + ynh_script_progression --message="Migrating old (pre-2018) database scheme..." --weight=11 + + ynh_exec_warn_less ynh_mysql_execute_file_as_root --database="$db_name" --file="../conf/foreign-keys-removal.sql" + ynh_script_progression --message="Database migration done. Resuming normal upgrade process" --weight=11 +fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From efc5ada3faf54dd2d90f8f5d09e918053f107662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 13:23:41 +0100 Subject: [PATCH 3/5] Cleanup cache on change_url --- scripts/change_url | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/change_url b/scripts/change_url index ded4d93..ae6fd3f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -37,6 +37,11 @@ if [ "$download_images_enabled" = "1" ]; then <<< "UPDATE entry SET content = REPLACE(content, '$old_domain$old_path', '$new_domain$new_path');" fi +# Clear assets cache +ynh_secure_remove --file="$install_dir/var/cache" +mkdir "$install_dir/var/cache" +chown "$app:www-data" "$install_dir/var/cache" + #================================================= # END OF SCRIPT #================================================= From 35c255dfafb1e7be6de8307f22ce04d28b50322a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 15 Mar 2024 13:25:12 +0100 Subject: [PATCH 4/5] Bump to v2.6.8 --- manifest.toml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/manifest.toml b/manifest.toml index 4703e6d..2c64f0b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Wallabag" description.en = "Save and classify articles. Read them later" description.fr = "Enregistrez et classez les articles. Lisez-les plus tard" -version = "2.5.4~ynh3" +version = "2.6.8~ynh1" maintainers = ["lapineige"] @@ -47,8 +47,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/wallabag/wallabag/releases/download/2.5.4/wallabag-2.5.4.tar.gz" - sha256 = "c953105e3181f18bf592541a1c46c318c6663ad00d4687052676b02a7d74c618" + url = "https://github.com/wallabag/wallabag/releases/download/2.6.8/wallabag-2.6.8.tar.gz" + sha256 = "a6641769faa9779ad3c012181bd367c0820fb5ae8493b89868f687bf3d6ce79d" autoupdate.strategy = "latest_github_release" @@ -62,18 +62,18 @@ ram.runtime = "50M" [resources.apt] packages = [ "mariadb-server", - "php7.4-cli", - "php7.4-curl", - "php7.4-gd", - "php7.4-gettext", - "php7.4-intl", - "php7.4-json", - "php7.4-ldap", - "php7.4-mbstring", - "php7.4-mysql", - "php7.4-redis", - "php7.4-tidy", - "php7.4-xml", + "php8.2-cli", + "php8.2-curl", + "php8.2-gd", + "php8.2-gettext", + "php8.2-intl", + "php8.2-json", + "php8.2-ldap", + "php8.2-mbstring", + "php8.2-mysql", + "php8.2-redis", + "php8.2-tidy", + "php8.2-xml", ] [resources.database] From b5592acd6c4b32b0e5e9c78c80c33cb0f844220e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 15 Mar 2024 12:25:20 +0000 Subject: [PATCH 5/5] 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 5972aaa..a702035 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html). -**Shipped version:** 2.5.4~ynh3 +**Shipped version:** 2.6.8~ynh1 **Demo:** diff --git a/README_fr.md b/README_fr.md index 1ef87cb..27d7929 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Sont disponibles une interface web, des add-ons pour navigateurs (Firefox/Chrome La mise à niveau depuis le paquet YunoHost de [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) demande une opération manuelle, c'est pourquoi un nouveau paquet est fournit. Pour le processus de migration, merci de vous référer à [la documentation officiel de Wallabag](https://doc.wallabag.org/fr/user/import/wallabagv1.html). -**Version incluse :** 2.5.4~ynh3 +**Version incluse :** 2.6.8~ynh1 **Démo :**