Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions library/Feeds/FeedCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
5 changes: 4 additions & 1 deletion library/Feeds/FeedReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
6 changes: 3 additions & 3 deletions library/Feeds/Storage/FilesystemStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions library/Feeds/Web/FeedContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down