mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-02-05 20:52:14 -05:00
Merge branch 'reset-transient-v1' into 'master'
When clearing all data, also reset ETags Closes #2851 See merge request fdroid/fdroidclient!1462
This commit is contained in:
@@ -684,7 +684,8 @@ internal interface AppDaoInt : AppDao {
|
||||
/**
|
||||
* Removes all apps and associated data such as versions from the database.
|
||||
* Careful: Doing this without other measures such as calling [RepositoryDaoInt.resetTimestamps]
|
||||
* will cause application of diffs to fail.
|
||||
* and [RepositoryDaoInt.resetETags] will cause things to break
|
||||
* e.g. application of diffs to fail.
|
||||
*/
|
||||
@Query("DELETE FROM ${AppMetadata.TABLE}")
|
||||
fun clearAll()
|
||||
|
||||
@@ -83,6 +83,7 @@ internal abstract class FDroidDatabaseInt : RoomDatabase(), FDroidDatabase, Clos
|
||||
runInTransaction {
|
||||
getAppDao().clearAll()
|
||||
getRepositoryDao().resetTimestamps()
|
||||
getRepositoryDao().resetETags()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.fdroid.database.DbDiffUtils.diffAndUpdateListTable
|
||||
import org.fdroid.database.DbDiffUtils.diffAndUpdateTable
|
||||
import org.fdroid.index.IndexFormatVersion
|
||||
import org.fdroid.index.IndexParser.json
|
||||
import org.fdroid.index.v1.IndexV1Updater
|
||||
import org.fdroid.index.v2.IndexV2Updater
|
||||
import org.fdroid.index.v2.MirrorV2
|
||||
import org.fdroid.index.v2.ReflectionDiffer.applyDiff
|
||||
@@ -420,7 +421,7 @@ internal interface RepositoryDaoInt : RepositoryDao {
|
||||
// move repoToReorder in place of repoTarget
|
||||
setWeight(repoToReorder.repoId, repoTarget.weight)
|
||||
// also adjust weight of archive repo, if it exists
|
||||
val archiveRepoId = repoToReorder.certificate?.let { getArchiveRepoId(it) }
|
||||
val archiveRepoId = getArchiveRepoId(repoToReorder.certificate)
|
||||
if (archiveRepoId != null) {
|
||||
setWeight(archiveRepoId, repoTarget.weight - 1)
|
||||
}
|
||||
@@ -514,6 +515,13 @@ internal interface RepositoryDaoInt : RepositoryDao {
|
||||
@Query("UPDATE ${CoreRepository.TABLE} SET timestamp = -1")
|
||||
fun resetTimestamps()
|
||||
|
||||
/**
|
||||
* Resets ETags for *all* repos in the database.
|
||||
* This will use cause a full index update when updating the repository via [IndexV1Updater].
|
||||
*/
|
||||
@Query("UPDATE ${RepositoryPreferences.TABLE} SET lastETag = NULL")
|
||||
fun resetETags()
|
||||
|
||||
/**
|
||||
* Use when replacing an existing repo with a full index.
|
||||
* This removes all existing index data associated with this repo from the database,
|
||||
|
||||
Reference in New Issue
Block a user