1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

www/tt-rss: Update to g20230509 and move database drivers to post config

- Update to g20230509 11946f014
- Move php database drivers a post install operation allowing the port
  to support both databases without having to make option changes or
  rebuilds.
- Update ttrssd to check for the configured driver

PR:		271397
This commit is contained in:
Derek Schrock 2023-05-13 17:20:07 -04:00 committed by Koichiro Iwao
parent ebfe8d5273
commit 9b9114f7e7
7 changed files with 68 additions and 21 deletions

View File

@ -5,6 +5,20 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20230513:
AFFECTS: users of www/tt-rss
AUTHOR: dereks@lifeofadishwasher.com
www/tt-rss now expects the user to install the database drivers by hand
allowing the port to be database independent however it would be best if you
mark the php driver packages as a non-automatic package such that
pkg-autoremove doesn't uninstall them.
Change 80 to your corresponding php version (80, 81, 82)
mysql: pkg set -yA 0 php80-mysqli php80-pdo_mysql;
pgsql: pkg set -yA 0 php80-pgsql php80-pdo_pgsql;
20230511:
AFFECTS: users of net-mgmt/py-netbox-secretstore
AUTHOR: kai@FreeBSD.org

View File

@ -1,5 +1,5 @@
PORTNAME= tt-rss
PORTVERSION= g20230413
PORTVERSION= g20230509
PORTEPOCH= 2
CATEGORIES= www
@ -15,7 +15,7 @@ USES= gettext-tools php:cli,web shebangfix
USE_GITLAB= yes
GL_SITE= https://gitlab.tt-rss.org
GL_COMMIT= 0578bf802571781a0a7e3debbbec66437a7d28b4
GL_COMMIT= 11946f0148d0b8a76ecc120fd9c1dc0b7fa04664
USE_PHP= ctype dom exif fileinfo filter iconv intl mbstring openssl \
pcntl pdo phar posix session simplexml tokenizer xml xmlwriter \
@ -29,18 +29,22 @@ REINPLACE_ARGS= -i ""
NO_ARCH= yes
NO_BUILD= yes
SUB_FILES= config.php httpd-tt-rss.conf pkg-message
SUB_LIST= MYSQL=${MYSQL} \
PGSQL=${PGSQL} \
# Instead of depending on the extact database driver list php packages that tt-rss
# depends on during install pkg-message as a post install setup.
# mysql: php-mysqli php-pdo_mysql
# pgsql: php-pgsql php-pdo_pgsql
#
# from Mk/Uses/php.mk create sub vars for mysqli/pdo_mysql pgsql/pdo_pgsql values
SUB_FILES= config.php httpd-tt-rss.conf pkg-message ttrss_db_check.php
SUB_LIST= MYSQL_DEPS="${mysqli_DEPENDS:T} ${pdo_mysql_DEPENDS:T}" \
PGSQL_DEPS="${pgsql_DEPENDS:T} ${pdo_pgsql_DEPENDS:T}" \
WWWOWN=${WWWOWN}
PLIST_SUB= WWWGRP=${WWWGRP} \
WWWOWN=${WWWOWN}
OPTIONS_DEFINE= CURL GD
OPTIONS_DEFAULT= CURL GD MYSQL
OPTIONS_SINGLE= DB
OPTIONS_SINGLE_DB= MYSQL PGSQL
OPTIONS_DEFAULT= CURL GD
CURL_DESC= Use SimplePie instead of Magpie
GD_DESC= Use OTP QR code generation
@ -48,12 +52,6 @@ GD_DESC= Use OTP QR code generation
CURL_USE= PHP=curl
GD_USE= PHP=gd
MYSQL_USE= PHP=mysqli,pdo_mysql
MYSQL_VARS_OFF= MYSQL="\#"
PGSQL_USE= PHP=pdo_pgsql,pgsql
PGSQL_VARS_OFF= PGSQL="\#"
do-install:
${MKDIR} \
${STAGEDIR}${WWWDIR} \
@ -68,6 +66,8 @@ do-install:
${RM} ${STAGEDIR}${WWWDIR}/config.php-dist
${INSTALL_DATA} ${WRKDIR}/config.php \
${STAGEDIR}${WWWDIR}/config.php.sample
${INSTALL_DATA} ${WRKDIR}/ttrss_db_check.php \
${STAGEDIR}${WWWDIR}/ttrss_db_check.php
${INSTALL_DATA} ${FILESDIR}/newsyslog.sample \
${STAGEDIR}${EXAMPLESDIR}

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1682227775
SHA256 (tt-rss-tt-rss-0578bf802571781a0a7e3debbbec66437a7d28b4_GL0.tar.gz) = 76ec95062cfe868f6530c790e93f2dfe8ad40019b1015ce0e5b1398abc08e5df
SIZE (tt-rss-tt-rss-0578bf802571781a0a7e3debbbec66437a7d28b4_GL0.tar.gz) = 8489761
TIMESTAMP = 1684011742
SHA256 (tt-rss-tt-rss-11946f0148d0b8a76ecc120fd9c1dc0b7fa04664_GL0.tar.gz) = e561b30e047ad727a91eb8e8597add2d4210b46f5404855c5cf6a8a93cde5bc7
SIZE (tt-rss-tt-rss-11946f0148d0b8a76ecc120fd9c1dc0b7fa04664_GL0.tar.gz) = 8490369

View File

@ -3,6 +3,13 @@
message: <<EOM
Tiny Tiny RSS is now installed, but it requires some additional setup.
Install your corresponding php database drivers:
msyql: mysqli pdo_mysql
pkg install %%MYSQL_DEPS%%
postgresql: pgsql pdo_pgsql
pkg install %%PGSQL_DEPS%%
You now need to create a database, a database user, configure the
web server, and configure tt-rss. Sample apache24 configs located
at %%DATADIR%%/httpd-tt-rss.conf.

View File

@ -0,0 +1,8 @@
<?php
chdir("%%WWWDIR%%");
require_once "%%WWWDIR%%/classes/config.php";
require_once "%%WWWDIR%%/include/functions.php";
print(strtolower(Config::get(Config::DB_TYPE)));
?>

View File

@ -23,6 +23,7 @@ load_rc_config "${name}"
: ${ttrssd_local_db:="YES"}
initdb_php="%%WWWDIR%%/update.php"
dbcheck_php="%%WWWDIR%%/ttrss_db_check.php"
required_files="%%WWWDIR%%/config.php"
pidfile="/var/run/${name}.pid"
ppidfile="/var/run/${name}_parent.pid"
@ -37,10 +38,10 @@ start_precmd=${name}_prestart
start_cmd=${name}_start
stop_cmd=${name}_stop
%%MYSQL%%CHECK_CMD="%%LOCALBASE%%/bin/mysqladmin -u mysqld ping"
%%MYSQL%%CHECK_MSG="${name}: mysqladmin command failed; mysql not ready?"
%%PGSQL%%CHECK_CMD="%%LOCALBASE%%/bin/pg_isready"
%%PGSQL%%CHECK_MSG="${name}: postgresql status failed; postgresql not ready?"
MYSQL_CHECK_CMD="%%LOCALBASE%%/bin/mysqladmin -u mysqld ping"
MYSQL_CHECK_MSG="${name}: mysqladmin command failed; mysql not ready?"
PGSQL_CHECK_CMD="%%LOCALBASE%%/bin/pg_isready"
PGSQL_CHECK_MSG="${name}: postgresql status failed; postgresql not ready?"
ttrssd_start() {
if ! [ -x $phpcli ]; then
@ -75,6 +76,22 @@ ttrssd_prestart() {
if checkyesno ttrssd_local_db; then
# Wait for the local database to be started
database="$("$phpcli" -f "$dbcheck_php")"
case "$database" in
"mysql")
CHECK_CMD="$MYSQL_CHECK_CMD"
CHECK_MSG="$MYSQL_CHECK_MSG"
;;
"pgsql")
CHECK_CMD="$PGSQL_CHECK_CMD"
CHECK_MSG="$PGSQL_CHECK_MSG"
;;
*)
err 1 "Unknown database configured: $database"
;;
esac
for n in $(seq 1 10); do
if $CHECK_CMD > /dev/null 2>&1; then
return

View File

@ -2017,6 +2017,7 @@
%%WWWDIR%%/plugins/toggle_sidebar/init.php
%%WWWDIR%%/prefs.php
%%WWWDIR%%/public.php
%%WWWDIR%%/ttrss_db_check.php
%%WWWDIR%%/schema/ttrss_schema_mysql.sql
%%WWWDIR%%/schema/ttrss_schema_pgsql.sql
%%WWWDIR%%/sql/mysql/migrations/3.sql