Merge pull-request #451

This commit is contained in:
Frederic Guillot 2015-12-14 19:13:10 -05:00
commit 42340702b1
3 changed files with 32 additions and 5 deletions

View File

@ -240,6 +240,6 @@ return array(
'Unable to detect the feed format.' => 'Impossible de détecter le format du flux.',
'add a new group' => 'ajouter un nouveau libellé',
'Groups' => 'Libellés',
'Back to the group' => 'Revenir sur le groupe'
'Back to the group' => 'Revenir sur le groupe',
'view' => 'voir',
);

View File

@ -435,6 +435,8 @@ function update_cache($feed_id, $last_modified, $etag)
function remove($feed_id)
{
delete_favicon($feed_id);
Group\remove_all($feed_id);
// Items are removed by a sql constraint
return Database::getInstance('db')->table('feeds')->eq('id', $feed_id)->remove();
}

View File

@ -151,11 +151,39 @@ function add($feed_id, $group_ids)
*/
function remove($feed_id, $group_ids)
{
return Database::getInstance('db')
$result = Database::getInstance('db')
->table('feeds_groups')
->eq('feed_id', $feed_id)
->in('group_id', $group_ids)
->remove();
// remove empty groups
if ($result) {
purge_groups();
}
return $result;
}
/**
* Remove all groups from feed
*
* @param integer $feed_id id of the feed
* @return boolean true on success, false on error
*/
function remove_all($feed_id)
{
$result = Database::getInstance('db')
->table('feeds_groups')
->eq('feed_id', $feed_id)
->remove();
// remove empty groups
if ($result) {
purge_groups();
}
return $result;
}
/**
@ -213,8 +241,5 @@ function update_feed_groups($feed_id, $group_ids, $create_group = '')
return false;
}
// cleanup
purge_groups();
return true;
}