From 4565f58a75aa911fd3e860ac8aa6168fa3a39951 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Thu, 30 Jul 2015 17:30:58 +1000 Subject: [PATCH] Clear out the etag from the repo table to "force" update. We are not forcing an update, in the sense that we make the update service run. Rather, we are ensuring that the next update wont return after doing nothing, with the message "repos already up to date". In this case, the repo metadata (and hence its etag) is the same, but we made changes in the client to handle the metadata correctly. Thus, we don't care that it hasn't changed, we want to update anyhow. --- F-Droid/src/org/fdroid/fdroid/data/DBHelper.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java b/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java index 98f1d39a0..ea3a153b0 100644 --- a/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java +++ b/F-Droid/src/org/fdroid/fdroid/data/DBHelper.java @@ -437,9 +437,20 @@ public class DBHelper extends SQLiteOpenHelper { if (oldVersion < 50) { Log.i(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated."); AppProvider.UpgradeHelper.updateIconUrls(context, db); + clearRepoEtags(db); } } + /** + * By clearing the etags stored in the repo table, it means that next time the user updates + * their repos (either manually or on a scheduled task), they will update regardless of whether + * they have changed since last update or not. + */ + private void clearRepoEtags(SQLiteDatabase db) { + Log.i(TAG, "Clearing repo etags, so next update will not be skipped with \"Repos up to date\"."); + db.execSQL("update " + TABLE_REPO + " set lastetag = NULL"); + } + private void resetTransient(SQLiteDatabase db, int oldVersion) { // Before version 42, only transient info was stored in here. As of some time // just before 42 (F-Droid 0.60ish) it now has "ignore this version" info which @@ -451,7 +462,7 @@ public class DBHelper extends SQLiteOpenHelper { .putBoolean("triedEmptyUpdate", false).commit(); db.execSQL("drop table " + TABLE_APP); db.execSQL("drop table " + TABLE_APK); - db.execSQL("update " + TABLE_REPO + " set lastetag = NULL"); + clearRepoEtags(db); createAppApk(db); } }