[epiphany/gnome-3-32] profile-migrator: Fix migrators maybe not running for default profile



commit 49bc09c154a479d47b0cb767e0796a6846ec61e1
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Mar 16 12:40:39 2019 -0500

    profile-migrator: Fix migrators maybe not running for default profile
    
    Problem is, Epiphany creates the new profile dir with current migration
    version if it does not exist on startup, BEFORE running the migrator. So
    all migrators are guaranteed to never run if ~/.local/share/epiphany
    does not exist. This makes testing migration really hard.
    
    Still, this would probably not be a problem for most users, since they
    will have local storage and databases stored here already.

 src/profile-migrator/ephy-profile-migrator.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index a37f7acc1..a9d9c525e 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1278,6 +1278,7 @@ ephy_migrator (void)
 {
   int latest, i;
   EphyProfileMigrator m;
+  g_autofree char *legacy_migration_file = NULL;
 
   /* If after this point there's no profile dir, there's no point in
    * running anything because Epiphany has never run in this system, so
@@ -1301,8 +1302,11 @@ ephy_migrator (void)
     return TRUE;
   }
 
-  latest = MAX (ephy_profile_utils_get_migration_version (),
-                ephy_profile_utils_get_migration_version_for_profile_dir (legacy_profile_dir ()));
+  legacy_migration_file = g_build_filename (legacy_profile_dir (), ".migrated", NULL);
+  if (g_file_test (legacy_migration_file, G_FILE_TEST_EXISTS))
+    latest = ephy_profile_utils_get_migration_version_for_profile_dir (legacy_profile_dir ());
+  else
+    latest = ephy_profile_utils_get_migration_version ();
 
   LOG ("Running migrators up to version %d, current migration version is %d.",
        EPHY_PROFILE_MIGRATION_VERSION, latest);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]