Change to PDODocument library
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use BitBadger\Documents\DocumentException;
|
||||
use BitBadger\Documents\SQLite\Configuration;
|
||||
use BitBadger\Documents\SQLite\Find;
|
||||
use BitBadger\PDODocument\Configuration;
|
||||
use BitBadger\PDODocument\DocumentException;
|
||||
use BitBadger\PDODocument\Find;
|
||||
use FeedReaderCentral\Feed;
|
||||
use FeedReaderCentral\Table;
|
||||
use FeedReaderCentral\User;
|
||||
@@ -37,7 +37,7 @@ function display_help(): never
|
||||
function refresh_all(): void
|
||||
{
|
||||
try {
|
||||
$db = Configuration::dbConn();
|
||||
$pdo = Configuration::dbConn();
|
||||
} catch (DocumentException $ex) {
|
||||
printfn("ERR: Cannot obtain a connection to the database\n $ex");
|
||||
return;
|
||||
@@ -45,8 +45,8 @@ function refresh_all(): void
|
||||
|
||||
try {
|
||||
$users = [];
|
||||
iterator_apply(Feed::retrieveAll()->items(), function (Feed $feed) use ($db, &$users) {
|
||||
$result = Feed::refreshFeed($feed->id, $feed->url, $db);
|
||||
iterator_apply(Feed::retrieveAll()->items(), function (Feed $feed) use ($pdo, &$users) {
|
||||
$result = Feed::refreshFeed($feed->id, $feed->url, $pdo);
|
||||
$userKey = "$feed->user_id";
|
||||
if (!key_exists($userKey, $users)) $users[$userKey] = Find::byId(Table::USER, $feed->user_id, User::class);
|
||||
if (array_key_exists('error', $result)) {
|
||||
@@ -61,7 +61,4 @@ function refresh_all(): void
|
||||
printfn("ERR $ex");
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
$db->close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user