From f21ed68215bb5a8e204c9672806c87fa7a453b95 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 4 Sep 2026 15:31:53 +0200 Subject: [PATCH 1/3] Fix some typos --- README.md | 1 + library/Feeds/Storage/FilesystemStorage.php | 4 ++-- library/Feeds/Web/FeedContent.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 790b0df..b2d738c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Note that this is not intended to be a full-featured feed reader. ## Installation Requirements * PHP version ≥ 8.2 +* Icinga Web2 ≥ 2.14 ## Documentation diff --git a/library/Feeds/Storage/FilesystemStorage.php b/library/Feeds/Storage/FilesystemStorage.php index d82257e..0b25c21 100644 --- a/library/Feeds/Storage/FilesystemStorage.php +++ b/library/Feeds/Storage/FilesystemStorage.php @@ -68,7 +68,7 @@ protected function loadFeedFile(string $filename): FeedDefinition throw new NotReadableError('Could not read file %s', $filePath); } - // This will throw an expection, which we will catch just like the others + // This will throw an exception, which we will catch just like the others $json = Json::decode($data, true); $feed = FeedDefinition::fromArray($json); @@ -100,7 +100,7 @@ protected function storeFeedFile(FeedDefinition $feed): void } /** - * removeFeedFile removes a feed's file by its anme + * removeFeedFile removes a feed's file by its name */ public function removeFeedFile(string $filename): bool { diff --git a/library/Feeds/Web/FeedContent.php b/library/Feeds/Web/FeedContent.php index 4a669f0..c60f54d 100644 --- a/library/Feeds/Web/FeedContent.php +++ b/library/Feeds/Web/FeedContent.php @@ -8,7 +8,7 @@ /** * Feed content represents arbitrary feed body. - * The raw data of the body is escaped and formated for output in icingaweb2 + * The raw data of the body is escaped and formatted for output in icingaweb2 */ class FeedContent extends HtmlString { @@ -36,7 +36,7 @@ public function __construct(string $text) $text = trim($text); // Add zero-width space after commas which are not followed by a whitespace character - // in oder to help browsers to break words + // in order to help browsers to break words $text = preg_replace('/,(?=[^\s])/', ',​', $text); parent::__construct($text); From aaf2f98632bcf60c80ecd37c5775b76ac36ebed8 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 4 Sep 2026 15:39:16 +0200 Subject: [PATCH 2/3] Small fix in error handling --- library/Feeds/FeedCache.php | 5 +++++ library/Feeds/Storage/FilesystemStorage.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Feeds/FeedCache.php b/library/Feeds/FeedCache.php index 0869120..3186bf3 100644 --- a/library/Feeds/FeedCache.php +++ b/library/Feeds/FeedCache.php @@ -17,6 +17,11 @@ class FeedCache extends FileCache */ public function clearAll(): void { + // Probably not gonna happen but why not + if (!is_dir($this->basedir)) { + return; + } + $iterator = new FilesystemIterator($this->basedir); foreach ($iterator as $file) { if (!$file->isFile()) { diff --git a/library/Feeds/Storage/FilesystemStorage.php b/library/Feeds/Storage/FilesystemStorage.php index 0b25c21..ee9e6d5 100644 --- a/library/Feeds/Storage/FilesystemStorage.php +++ b/library/Feeds/Storage/FilesystemStorage.php @@ -176,7 +176,7 @@ protected function load(): void try { $feed = $this->loadFeedFile($name); } catch (Exception $ex) { - Logger::error('Failed to load feed file "%s": %s', $name, $e); + Logger::error('Failed to load feed file "%s": %s', $name, $ex); continue; } From 6c029d609e5d92beb32eb966dcadff43b8279e19 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 4 Sep 2026 15:45:03 +0200 Subject: [PATCH 3/3] Add connect_timeout to Guzzle Client --- library/Feeds/FeedReader.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Feeds/FeedReader.php b/library/Feeds/FeedReader.php index b9d1e49..82e0dbe 100644 --- a/library/Feeds/FeedReader.php +++ b/library/Feeds/FeedReader.php @@ -57,7 +57,10 @@ protected function fetchFeed(): string { $timeoutInSeconds = $this->config->get('http', 'timeout', 5); - $client = $this->client ?? new Client(['timeout' => $timeoutInSeconds]); + $client = $this->client ?? new Client([ + 'timeout' => $timeoutInSeconds, + 'connect_timeout' => $timeoutInSeconds, + ]); $response = $client->request('GET', $this->url, [ 'headers' => [