clean up db when deleting a repository

Previously everything from a repo staying inside the db when removing it
without disabling it first, the problem manifests when the repo is
readded later (or a mirror), as it would get a new id but all apk
entries still point to the original repoid.

So we now first disable a repo (which just calls
RepoProvider.Helper.purgeApps) before deleting it from the db.

closes Bubu/fdroidclassic#29
This commit is contained in:
Marcus Hoffmann 2020-05-18 23:32:47 +02:00
parent 527917393e
commit a965deb51e

View File

@ -233,6 +233,7 @@ public class RepoProvider extends FDroidProvider {
}
public static void remove(Context context, long repoId) {
purgeApps(context, findById(context, repoId));
ContentResolver resolver = context.getContentResolver();
Uri uri = RepoProvider.getContentUri(repoId);
resolver.delete(uri, null, null);