beta4 changes #26

Merged
danieljsummers merged 7 commits from beta5 into main 2024-08-06 23:20:17 +00:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit 1d442d2bfe - Show all commits

View File

@ -119,7 +119,7 @@ class Feed
} }
}, array_filter($parsed->items, }, array_filter($parsed->items,
fn(ParsedItem $it) => date_create_immutable($it->updatedOn ?? $it->publishedOn) >= $lastChecked)); 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); 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; if ($url !== $feed->url) $patch['url'] = $feed->url;
Patch::byId(Table::Feed, $feedId, $patch); Patch::byId(Table::Feed, $feedId, $patch);
return Result::OK(true);
}) })
->bind(fn() => PURGE_TYPE === self::PurgeNone ? Result::OK(true) : self::purgeItems($feedId)); ->bind(fn() => PURGE_TYPE === self::PurgeNone ? Result::OK(true) : self::purgeItems($feedId));
} catch (DocumentException $ex) { } catch (DocumentException $ex) {

View File

@ -270,7 +270,7 @@ readonly class ParsedFeed
->bind(function (DOMDocument $parsed) use ($doc) { ->bind(function (DOMDocument $parsed) use ($doc) {
$extract = $parsed->getElementsByTagNameNS(self::ATOM_NS, 'feed')->length > 0 $extract = $parsed->getElementsByTagNameNS(self::ATOM_NS, 'feed')->length > 0
? self::fromAtom(...) : self::fromRSS(...); ? self::fromAtom(...) : self::fromRSS(...);
return $extract($parsed, $doc['url']); return $extract($parsed, $doc->getOK()['url']);
}); });
} }
} }