miniflux-legacy/app/models/item_group.php

29 lines
646 B
PHP
Raw Normal View History

2016-08-19 04:08:29 +02:00
<?php
2016-08-25 03:17:58 +02:00
namespace Miniflux\Model\ItemGroup;
2016-08-19 04:08:29 +02:00
use Miniflux\Model\Item;
2016-08-25 03:17:58 +02:00
use Miniflux\Model\Group;
use PicoDb\Database;
2016-08-19 04:08:29 +02:00
function change_items_status($user_id, $group_id, $current_status, $new_status, $before = null)
2016-08-19 04:08:29 +02:00
{
$feed_ids = Group\get_feed_ids_by_group($group_id);
2016-08-19 04:08:29 +02:00
if (empty($feed_ids)) {
return false;
}
2016-08-19 04:08:29 +02:00
$query = Database::getInstance('db')
->table(Item\TABLE)
->eq('user_id', $user_id)
->eq('status', $current_status)
->in('feed_id', $feed_ids);
if ($before !== null) {
$query->lte('updated', $before);
}
2016-08-19 04:08:29 +02:00
return $query->update(array('status' => $new_status));
2016-08-19 04:08:29 +02:00
}