From 117d210c8aa3b1b1513d6e5a756f4b3242d3b392 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sat, 25 Jan 2025 01:52:01 +0000 Subject: [PATCH 1/3] Include 'cache/feed-icons' in the default backup process. This is worthwhile since custom icons might've been uploaded and post-restore icon fetches might take a while. --- .docker/app/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/app/backup.sh b/.docker/app/backup.sh index 784982c70..4ecc860b9 100644 --- a/.docker/app/backup.sh +++ b/.docker/app/backup.sh @@ -18,7 +18,7 @@ if pg_isready -h $TTRSS_DB_HOST -U $TTRSS_DB_USER -p $TTRSS_DB_PORT; then echo backing up tt-rss local directories to $DST_DIR/$DST_FILE... tar -cz -f $DST_DIR/$DST_FILE $APP_ROOT/*.local \ - $APP_ROOT/feed-icons/ \ + $APP_ROOT/cache/feed-icons/ \ $APP_ROOT/config.php echo cleaning up... From 7618101e333c2d3c183031d52d1b3adfa0b3c009 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sun, 26 Jan 2025 17:19:12 +0000 Subject: [PATCH 2/3] Reduce use of legacy 'Config::ICONS_DIR'. Also some minor cleanup in 'API#_get_config()'. --- classes/API.php | 21 +++++++++------------ classes/RSSUtils.php | 5 ++++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/classes/API.php b/classes/API.php index 241663b3d..72c65ea54 100644 --- a/classes/API.php +++ b/classes/API.php @@ -366,22 +366,19 @@ class API extends Handler { } /** + * @see RPC::_make_init_params() + * @see RPC::_make_runtime_info() * @return array|bool|int|string> */ private function _get_config(): array { - $config = [ - "icons_dir" => Config::get(Config::ICONS_DIR), - "icons_url" => Config::get(Config::ICONS_URL) + return [ + 'custom_sort_types' => $this->_get_custom_sort_types(), + 'daemon_is_running' => file_is_locked('update_daemon.lock'), + 'icons_url' => Config::get_self_url() . '/public.php', + 'num_feeds' => ORM::for_table('ttrss_feeds') + ->where('owner_uid', $_SESSION['uid']) + ->count(), ]; - - $config["daemon_is_running"] = file_is_locked("update_daemon.lock"); - $config["custom_sort_types"] = $this->_get_custom_sort_types(); - - $config["num_feeds"] = ORM::for_table('ttrss_feeds') - ->where('owner_uid', $_SESSION['uid']) - ->count(); - - return $config; } function getConfig(): bool { diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php index 1c931e7e7..3ede6bf3e 100644 --- a/classes/RSSUtils.php +++ b/classes/RSSUtils.php @@ -1743,7 +1743,10 @@ class RSSUtils { $tmph->run_hooks(PluginHost::HOOK_HOUSE_KEEPING); } - /** migrates favicons from legacy storage in feed-icons/ to cache/feed-icons/using new naming (sans .ico suffix) */ + /** + * migrates favicons from legacy storage in feed-icons/ to cache/feed-icons/using new naming (sans .ico suffix) + * @todo Remove this and Config::ICONS_DIR at some point + */ static function migrate_feed_icons() : void { $old_dir = Config::get(Config::ICONS_DIR); From d361c1c65d912358c9a9eee1db1992ff532eb299 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sun, 26 Jan 2025 17:21:12 +0000 Subject: [PATCH 3/3] Remove now-unused 'Config::ICONS_URL'. --- classes/Config.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/classes/Config.php b/classes/Config.php index 356f81391..a7c0a04b2 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -73,9 +73,6 @@ class Config { /** directory for feed favicons (directory must be writable) */ const ICONS_DIR = "ICONS_DIR"; - /** URL for feed favicons */ - const ICONS_URL = "ICONS_URL"; - /** auto create users authenticated via external modules */ const AUTH_AUTO_CREATE = "AUTH_AUTO_CREATE"; @@ -208,7 +205,6 @@ class Config { Config::LOCK_DIRECTORY => [ "lock", Config::T_STRING ], Config::CACHE_DIR => [ "cache", Config::T_STRING ], Config::ICONS_DIR => [ "feed-icons", Config::T_STRING ], - Config::ICONS_URL => [ "feed-icons", Config::T_STRING ], Config::AUTH_AUTO_CREATE => [ "true", Config::T_BOOL ], Config::AUTH_AUTO_LOGIN => [ "true", Config::T_BOOL ], Config::FORCE_ARTICLE_PURGE => [ 0, Config::T_INT ],