Procházet zdrojové kódy

Respect simplepie_syslog_enabled for cache-hit debug logs (#8986)

Two "uses cache" LOG_DEBUG syslog() calls were emitted on every feed
refresh regardless of the simplepie_syslog_enabled setting, so users who
disabled it still saw "FreshRSS SimplePie uses cache for ..." spam in
syslog (issue #8540). Guard both with simplepie_syslog_enabled, like the
neighbouring SimplePie GET logs already are. Real error and fatal logs
are left untouched.

For https://github.com/FreshRSS/FreshRSS/issues/8540

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Jam Balaya před 22 hodinami
rodič
revize
241c7fb425
2 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 3 1
      app/Models/Feed.php
  2. 3 1
      app/Utils/httpUtil.php

+ 3 - 1
app/Models/Feed.php

@@ -682,7 +682,9 @@ class FreshRSS_Feed extends Minz_Model {
 					$this->_attribute('SimplePieHash', $simplePie->get_hash());
 					return $simplePie;
 				}
-				syslog(LOG_DEBUG, 'FreshRSS SimplePie uses cache for ' . $clean_url);
+				if (FreshRSS_Context::systemConf()->simplepie_syslog_enabled) {
+					syslog(LOG_DEBUG, 'FreshRSS SimplePie uses cache for ' . $clean_url);
+				}
 			}
 		}
 		return null;

+ 3 - 1
app/Utils/httpUtil.php

@@ -431,7 +431,9 @@ final class FreshRSS_http_Util {
 			if ($cacheMtime !== false && $cacheMtime > time() - intval($limits['cache_duration'])) {
 				$body = @file_get_contents($cachePath);
 				if ($body != false) {
-					syslog(LOG_DEBUG, 'FreshRSS uses cache for ' . \SimplePie\Misc::url_remove_credentials($url));
+					if (FreshRSS_Context::systemConf()->simplepie_syslog_enabled) {
+						syslog(LOG_DEBUG, 'FreshRSS uses cache for ' . \SimplePie\Misc::url_remove_credentials($url));
+					}
 					return ['body' => $body, 'effective_url' => $url, 'redirect_count' => 0, 'fail' => false, 'status' => -200, 'error' => ''];
 				}
 			}