diff --git a/README_fr.md b/README_fr.md index 0de5e3b..e23c632 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,6 @@ 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.6.9~ynh1 **Démo :** 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/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/manifest.toml b/manifest.toml index 6bdf738..1e9f9ad 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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] 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 #================================================= 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..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 @@ -38,18 +46,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)