1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

switch to PHP

This commit is contained in:
ericgaspar 2021-12-28 11:11:38 +01:00
parent 6e40d70458
commit cb7a1bc47f
8 changed files with 80 additions and 23 deletions

View file

@ -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

View file

@ -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"
#=================================================

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)
#=================================================