Fix refresh job (#24)
This commit is contained in:
parent
0c87392910
commit
c1901a68ec
|
@ -4,7 +4,7 @@ use BitBadger\PDODocument\{AutoId, Configuration};
|
||||||
use FeedReaderCentral\Data;
|
use FeedReaderCentral\Data;
|
||||||
|
|
||||||
/** The current Feed Reader Central version */
|
/** The current Feed Reader Central version */
|
||||||
const FRC_VERSION = '1.0.0-beta1';
|
const FRC_VERSION = '1.0.0-beta2';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drop .0 or .0.0 from the end of the version to format it for display
|
* Drop .0 or .0.0 from the end of the version to format it for display
|
||||||
|
|
|
@ -34,7 +34,7 @@ function refresh_all(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$users = [];
|
$users = [];
|
||||||
iterator_apply(Feed::retrieveAll()->items(), function (Feed $feed) use (&$users) {
|
foreach (Feed::retrieveAll()->items() as /** @var Feed $feed */ $feed) {
|
||||||
$result = Feed::refreshFeed($feed->id, $feed->url);
|
$result = Feed::refreshFeed($feed->id, $feed->url);
|
||||||
$userKey = "$feed->user_id";
|
$userKey = "$feed->user_id";
|
||||||
if (!key_exists($userKey, $users)) $users[$userKey] = Find::byId(Table::USER, $feed->user_id, User::class);
|
if (!key_exists($userKey, $users)) $users[$userKey] = Find::byId(Table::USER, $feed->user_id, User::class);
|
||||||
|
@ -44,7 +44,7 @@ function refresh_all(): void
|
||||||
} else {
|
} else {
|
||||||
printfn('OK (%s) %s', $users[$userKey]->email, $feed->url);
|
printfn('OK (%s) %s', $users[$userKey]->email, $feed->url);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
printfn(PHP_EOL . 'All feeds refreshed');
|
printfn(PHP_EOL . 'All feeds refreshed');
|
||||||
} catch (DocumentException $ex) {
|
} catch (DocumentException $ex) {
|
||||||
printfn("ERR $ex");
|
printfn("ERR $ex");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user