Remove PHP warning when there is no items to remove

This commit is contained in:
Frederic Guillot 2013-07-16 19:28:20 -04:00
parent 7de72b41e4
commit 6bd2e32615

View File

@ -577,16 +577,19 @@ function update_items($feed_id, array $items)
// Keep a buffer of 2 items // Keep a buffer of 2 items
// It's workaround for buggy feeds (cache issue with some Wordpress plugins) // It's workaround for buggy feeds (cache issue with some Wordpress plugins)
$items_to_remove = array_slice($removed_items, 2); if (is_array($removed_items)) {
if (! empty($items_to_remove)) { $items_to_remove = array_slice($removed_items, 2);
\PicoTools\singleton('db') if (! empty($items_to_remove)) {
->table('items')
->in('id', $items_to_remove) \PicoTools\singleton('db')
->eq('status', 'removed') ->table('items')
->eq('feed_id', $feed_id) ->in('id', $items_to_remove)
->remove(); ->eq('status', 'removed')
->eq('feed_id', $feed_id)
->remove();
}
} }
} }