示例#1
0
文件: update.php 项目: nogo/feedbox
                }
            }
            $source['errors'] = $worker->getErrors();
        } else {
            $error = true;
            $source['errors'] = $fetcher->getError();
        }
    }
    // update source unread counter
    $count = $source['unread'];
    $source['unread'] = $itemRepository->countSourceUnread([$source['id']]);
    $sourceRepository->setUserScope($user_id);
    $sourceRepository->persist($source);
    // update tag unread counter
    if (!empty($source['tag_id'])) {
        $tag = $tagRepository->find($source['tag_id']);
        if ($tag) {
            $tag['unread'] = $sourceRepository->countTagUnread([$tag['id']]);
            $tagRepository->setUserScope($user_id);
            $tagRepository->persist($tag);
        }
    }
    if ($config['debug']) {
        if ($error) {
            echo sprintf("%s\n", $source['errors']);
        } else {
            echo sprintf("%d new items.\n", abs($source['unread'] - $count));
        }
    }
}
// clean up double uids