mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
delete invalid DB files in batches, not one by one
This commit is contained in:
parent
8d7a5b1771
commit
03a83f5341
1 changed files with 11 additions and 6 deletions
|
@ -970,14 +970,19 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
getCachedMedia(directory.path, getVideosOnly, getImagesOnly) {
|
if (!directory.isRecycleBin()) {
|
||||||
it.forEach {
|
getCachedMedia(directory.path, getVideosOnly, getImagesOnly) {
|
||||||
if (!curMedia.contains(it)) {
|
val mediaToDelete = ArrayList<Medium>()
|
||||||
val path = (it as? Medium)?.path
|
it.forEach {
|
||||||
if (path != null) {
|
if (!curMedia.contains(it)) {
|
||||||
deleteDBPath(path)
|
val medium = it as? Medium
|
||||||
|
val path = medium?.path
|
||||||
|
if (path != null) {
|
||||||
|
mediaToDelete.add(medium)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mediaDB.deleteMedia(*mediaToDelete.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue