Tweaks to new result handling for feeds
This commit is contained in:
parent
adcfd9d02a
commit
1d442d2bfe
@ -119,7 +119,7 @@ class Feed
|
||||
}
|
||||
}, array_filter($parsed->items,
|
||||
fn(ParsedItem $it) => date_create_immutable($it->updatedOn ?? $it->publishedOn) >= $lastChecked));
|
||||
$errors = array_map(fn(Result $it) => $it->getError(), array_filter($results, Result::isError(...)));
|
||||
$errors = array_map(fn(Result $it) => $it->getError(), array_filter($results, fn($it) => $it->isError()));
|
||||
return sizeof($errors) > 0 ? Result::Error(implode("\n", $errors)) : Result::OK(true);
|
||||
}
|
||||
|
||||
@ -194,6 +194,7 @@ class Feed
|
||||
];
|
||||
if ($url !== $feed->url) $patch['url'] = $feed->url;
|
||||
Patch::byId(Table::Feed, $feedId, $patch);
|
||||
return Result::OK(true);
|
||||
})
|
||||
->bind(fn() => PURGE_TYPE === self::PurgeNone ? Result::OK(true) : self::purgeItems($feedId));
|
||||
} catch (DocumentException $ex) {
|
||||
|
@ -270,7 +270,7 @@ readonly class ParsedFeed
|
||||
->bind(function (DOMDocument $parsed) use ($doc) {
|
||||
$extract = $parsed->getElementsByTagNameNS(self::ATOM_NS, 'feed')->length > 0
|
||||
? self::fromAtom(...) : self::fromRSS(...);
|
||||
return $extract($parsed, $doc['url']);
|
||||
return $extract($parsed, $doc->getOK()['url']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user