Added unit tests on orphaned entries

This commit is contained in:
emeric
2019-05-16 13:49:56 +02:00
parent 41c317d3ff
commit febfe518ba
4 changed files with 111 additions and 30 deletions
+3 -7
View File
@@ -649,16 +649,12 @@ MediaScanner::removeOrphanEntries()
{
Wt::Dbo::Transaction transaction(_db.getSession());
// TODO better query for this
// Now process orphan Cluster (no track)
auto clusters = Cluster::getAll(_db.getSession());
auto clusters = Cluster::getAllOrphans(_db.getSession());
for (auto cluster : clusters)
{
if (cluster->getCount() == 0)
{
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan cluster '" << cluster->getName() << "'";
cluster.remove();
}
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan cluster '" << cluster->getName() << "'";
cluster.remove();
}
}