Display an error message listing empty feeds (no read/unread items)
This commit is contained in:
parent
a89d8c0005
commit
bfa5709c07
@ -344,6 +344,11 @@ Router\get_action('refresh-all', function() {
|
|||||||
// Display all feeds
|
// Display all feeds
|
||||||
Router\get_action('feeds', function() {
|
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(
|
Response\html(Template\layout('feeds', array(
|
||||||
'feeds' => Model\get_feeds(),
|
'feeds' => Model\get_feeds(),
|
||||||
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
'The following feeds are empty, there may be an error : ' =>
|
||||||
|
'Les abonnements suivants sont vides, il doit y avoir une erreur :',
|
||||||
'Items per page' => 'Nombre d\'éléments par page',
|
'Items per page' => 'Nombre d\'éléments par page',
|
||||||
'Previous page' => 'Page précédente',
|
'Previous page' => 'Page précédente',
|
||||||
'Next page' => 'Page suivante',
|
'Next page' => 'Page suivante',
|
||||||
|
24
model.php
24
model.php
@ -247,6 +247,30 @@ function get_feed($feed_id)
|
|||||||
->findOne();
|
->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)
|
function update_feed_last_checked($feed_id)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user