Modify /path/to/webroot/feeds/makeindex.php
and add the following code (only the concerned portion of code is shown for brevity):
// Run a loop on all feeds and fetch the items
foreach ($feeds as $row) {
// Fetch the feed
$feed->set_feed_url($row['url']);
$feed->init();
// Fetch all items of this feed
foreach ($feed->get_items() as $item) {
$id = $item->get_id(true);
/ Check if an item with same id (guid) exists in our database
$stmt = $dbh->prepare("SELECT id FROM items WHERE guid = ?");
$stmt->execute(array($id));
// If the item already exists
// we will skip it and continue to the next item
if ($stmt->rowCount()) {
continue;
}
query = "INSERT INTO items (title, guid, link, pub_date) VALUES (?, ?, ?, ?)";
$stmt = $dbh->prepare($query);
// Params to be binded in the sql
// If we have categories then insert them in database
if ($categories) {
// Insert the categories
foreach ($item->get_categories() as $category...