Remove PHP warning when there is no items to remove
This commit is contained in:
parent
7de72b41e4
commit
6bd2e32615
19
model.php
19
model.php
@ -577,16 +577,19 @@ function update_items($feed_id, array $items)
|
||||
|
||||
// Keep a buffer of 2 items
|
||||
// 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')
|
||||
->table('items')
|
||||
->in('id', $items_to_remove)
|
||||
->eq('status', 'removed')
|
||||
->eq('feed_id', $feed_id)
|
||||
->remove();
|
||||
if (! empty($items_to_remove)) {
|
||||
|
||||
\PicoTools\singleton('db')
|
||||
->table('items')
|
||||
->in('id', $items_to_remove)
|
||||
->eq('status', 'removed')
|
||||
->eq('feed_id', $feed_id)
|
||||
->remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user