Remove orphaned cluster types

This commit is contained in:
emeric
2018-03-04 15:34:33 +01:00
parent 2db46260ab
commit c0c5273e92
3 changed files with 19 additions and 0 deletions
+9
View File
@@ -725,6 +725,7 @@ MediaScanner::checkAudioFiles( Stats& stats )
{
Wt::Dbo::Transaction transaction(_db.getSession());
// TODO better query for this
// Now process orphan Cluster (no track)
auto clusters = Cluster::getAll(_db.getSession());
for (auto cluster : clusters)
@@ -735,6 +736,14 @@ MediaScanner::checkAudioFiles( Stats& stats )
cluster.remove();
}
}
// Now process orphan cluster types
auto clusterTypes = ClusterType::getAllOrphans(_db.getSession());
for (auto clusterType : clusterTypes)
{
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan cluster type '" << clusterType->getName() << "'";
clusterType.remove();
}
}
LMS_LOG(DBUPDATER, DEBUG) << "Checking artists...";