From 8565deba18eb543c0170df5a7100026ecca7c3eb Mon Sep 17 00:00:00 2001 From: x86dev Date: Thu, 25 Jul 2019 23:25:45 +0200 Subject: [PATCH] Made resetting the theme optional via TTRSS_THEME_RESET env var. Default is resetting the theme to the default one though. Untested. --- root/srv/setup-ttrss.sh | 10 ++++++++++ root/srv/ttrss-configure-db.php | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/root/srv/setup-ttrss.sh b/root/srv/setup-ttrss.sh index e3d549e..697cd7c 100755 --- a/root/srv/setup-ttrss.sh +++ b/root/srv/setup-ttrss.sh @@ -108,6 +108,11 @@ setup_ttrss() echo "Setup: URL is: $TTRSS_SELF_URL" + # By default we want to reset the theme to the default one. + if [ -z ${TTRSS_THEME_RESET} ]; then + TTRSS_THEME_RESET=1 + fi + # Patch URL path. sed -i -e 's@htt.*/@'"${TTRSS_SELF_URL}"'@g' ${TTRSS_PATH}/config.php @@ -131,6 +136,11 @@ setup_ttrss() echo "Setup: Additional plugins: $TTRSS_PLUGINS" sed -i -e "s/.*define('PLUGINS'.*/define('PLUGINS', '$TTRSS_PLUGINS, auth_internal, note, updater');/g" ${TTRSS_PATH}/config.php + + # Export variables for sub shells. + export TTRSS_PATH + export TTRSS_PATH_PLUGINS + export TTRSS_THEME_RESET } setup_db() diff --git a/root/srv/ttrss-configure-db.php b/root/srv/ttrss-configure-db.php index 7c7a4ad..39d6b05 100644 --- a/root/srv/ttrss-configure-db.php +++ b/root/srv/ttrss-configure-db.php @@ -65,10 +65,12 @@ try { echo 'Connection to database successful' . PHP_EOL; // Reached this point => table found, assume db is complete - // Make sure to set the default theme provided by TT-RSS. - // Other themes might break everything after an update, so play safe here. - echo 'Resetting theme to default ...' . PHP_EOL; - $pdo->query("UPDATE ttrss_user_prefs SET value = '' WHERE pref_name = 'USER_CSS_THEME'"); + if (env('TTRSS_THEME_RESET', '1')) { + // Make sure to set the default theme provided by TT-RSS. + // Other themes might break everything after an update, so play safe here. + echo 'Resetting theme to default ...' . PHP_EOL; + $pdo->query("UPDATE ttrss_user_prefs SET value = '' WHERE pref_name = 'USER_CSS_THEME'"); + } } catch (PDOException $e) { echo 'Database table not found, applying schema... ' . PHP_EOL;