From cb7a1bc47f0d86f2f531a5dbe3137f5e52e526a4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 28 Dec 2021 11:11:38 +0100 Subject: [PATCH] switch to PHP --- conf/config.php | 68 ++++++++++++++++++++++++++++++++++++++++++---- scripts/_common.sh | 2 +- scripts/backup | 6 ++-- scripts/change_url | 2 +- scripts/install | 6 ++-- scripts/remove | 6 ++-- scripts/restore | 11 ++++---- scripts/upgrade | 2 +- 8 files changed, 80 insertions(+), 23 deletions(-) diff --git a/conf/config.php b/conf/config.php index 0d4cc0e..eb78e63 100644 --- a/conf/config.php +++ b/conf/config.php @@ -4,16 +4,12 @@ // *** Database configuration (important!) *** // ******************************************* - putenv('TTRSS_DB_TYPE=mysql'); // or mysql + putenv('TTRSS_DB_TYPE=pgsql'); // or mysql putenv('TTRSS_DB_HOST=localhost'); putenv('TTRSS_DB_USER=__DB_NAME__'); putenv('TTRSS_DB_NAME=__DB_NAME__'); putenv('TTRSS_DB_PASS=__DB_PWD__'); - putenv('TTRSS_DB_PORT=3306'); // usually 5432 for PostgreSQL, 3306 for MySQL - - putenv('TTRSS_MYSQL_CHARSET=UTF8'); - // Connection charset for MySQL. If you have a legacy database and/or experience - // garbage unicode characters with this option, try setting it to a blank string. + putenv('TTRSS_DB_PORT=5432'); // usually 5432 for PostgreSQL, 3306 for MySQL // *********************************** // *** Basic settings (important!) *** @@ -132,3 +128,63 @@ putenv('TTRSS_SESSION_COOKIE_LIFETIME='.(86400*30)); // Default lifetime of a session (e.g. login) cookie. In seconds, // 0 means cookie will be deleted when browser closes. + + // ********************************* + // *** Email and digest settings *** + // ********************************* + + putenv('TTRSS_SMTP_FROM_NAME=Tiny Tiny RSS'); + putenv('TTRSS_SMTP_FROM_ADDRESS=noreply@your.domain.dom'); + // Name, address and subject for sending outgoing mail. This applies + // to password reset notifications, digest emails and any other mail. + + putenv('TTRSS_DIGEST_SUBJECT=[tt-rss] New headlines for last 24 hours'); + // Subject line for email digests + + putenv('TTRSS_SMTP_SERVER=localhost:25'); + // Hostname:port combination to send outgoing mail (i.e. localhost:25). + // Blank - use system MTA. + + putenv('TTRSS_SMTP_LOGIN='); + putenv('TTRSS_SMTP_PASSWORD='); + // These two options enable SMTP authentication when sending + // outgoing mail. Only used with SMTP_SERVER. + + putenv('TTRSS_SMTP_SECURE='); + // Used to select a secure SMTP connection. Allowed values: ssl, tls, + // or empty. + + // *************************************** + // *** Other settings (less important) *** + // *************************************** + + putenv('TTRSS_CHECK_FOR_UPDATES=true'); + // Check for updates automatically if running Git version + + putenv('TTRSS_ENABLE_GZIP_OUTPUT=false'); + // Selectively gzip output to improve wire performance. This requires + // PHP Zlib extension on the server. + // Enabling this can break tt-rss in several httpd/php configurations, + // if you experience weird errors and tt-rss failing to start, blank pages + // after login, or content encoding errors, disable it. + + putenv('TTRSS_PLUGINS=auth_internal, note'); + // Comma-separated list of plugins to load automatically for all users. + // System plugins have to be specified here. Please enable at least one + // authentication plugin here (auth_*). + // Users may enable other user plugins from Preferences/Plugins but may not + // disable plugins specified in this list. + // Disabling auth_internal in this list would automatically disable + // reset password link on the login form. + + putenv('TTRSS_LOG_DESTINATION=sql'); + // Log destination to use. Possible values: sql (uses internal logging + // you can read in Preferences -> System), syslog - logs to system log. + // Setting this to blank uses PHP logging (usually to http server + // error.log). + + putenv('TTRSS_CONFIG_VERSION=26'); + // Expected config version. Please update this option in config.php + // if necessary (after migrating all new options from this file). + + // vim:ft=php diff --git a/scripts/_common.sh b/scripts/_common.sh index d77187a..db3b544 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="7.3" -pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-opcache \ +pkg_dependencies="postgresql php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-opcache \ php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml" #================================================= diff --git a/scripts/backup b/scripts/backup index edae2c2..bb8a185 100644 --- a/scripts/backup +++ b/scripts/backup @@ -59,11 +59,11 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE MYSQL DATABASE +# BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the PostgreSQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index d3e030f..60a66ca 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,7 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index b0d5145..0a11ec1 100644 --- a/scripts/install +++ b/scripts/install @@ -65,12 +65,12 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=2 +ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +ynh_psql_test_if_first_run +ynh_psql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/remove b/scripts/remove index 53b546e..5a05a7e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -43,12 +43,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..." ynh_remove_systemd_config #================================================= -# REMOVE THE MYSQL DATABASE +# REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=4 +ynh_script_progression --message="Removing the PostgreSQL database..." --weight=2 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 7a5b057..02a0d21 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -84,13 +85,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=5 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_psql_test_if_first_run +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 18d8108..7b051a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #=================================================