diff --git a/index.php b/index.php index ab1e565..8583d67 100644 --- a/index.php +++ b/index.php @@ -344,6 +344,11 @@ Router\get_action('refresh-all', function() { // Display all feeds Router\get_action('feeds', function() { + $empty_feeds = Model\get_empty_feeds(); + if (count($empty_feeds) > 0) { + $message = t('The following feeds are empty, there may be an error : ') . implode(', ', $empty_feeds); + Session\flash_error($message); + } Response\html(Template\layout('feeds', array( 'feeds' => Model\get_feeds(), 'nothing_to_read' => Request\int_param('nothing_to_read'), diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index 404ffb9..3acad94 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -1,6 +1,8 @@ + 'Les abonnements suivants sont vides, il doit y avoir une erreur :', 'Items per page' => 'Nombre d\'éléments par page', 'Previous page' => 'Page précédente', 'Next page' => 'Page suivante', diff --git a/model.php b/model.php index d67a3bb..541cb7a 100644 --- a/model.php +++ b/model.php @@ -247,6 +247,30 @@ function get_feed($feed_id) ->findOne(); } +function get_empty_feeds() +{ + $feeds = \PicoTools\singleton('db') + ->table('feeds') + ->gt('last_checked', 0) + ->asc('id') + ->listing('id', 'title'); + $ids = array_keys($feeds); + + // fake DISTINCT + $not_empty_feeds = \PicoTools\singleton('db') + ->table('items') + ->asc('feed_id') + ->listing('feed_id', 'feed_id'); + $not_empty_ids = array_keys($not_empty_feeds); + + $diff = array_diff($ids, $not_empty_ids); + $return = array(); + foreach ($diff as $id) { + $return[$id] = $feeds[$id]; + } + return $return; +} + function update_feed_last_checked($feed_id) {