aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-09-03 22:33:47 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2012-09-04 02:37:15 +0800
commit1afb0171665b4234ceb57f073a0834b6dc3e005d (patch)
tree75f16b2d1f9320a4c1aae49c6d5dff026d3a05ff
parent55ffe5b0442e58a42a5812c749359a3f22a489d1 (diff)
downloadgsoc2013-epiphany-1afb0171665b4234ceb57f073a0834b6dc3e005d.tar.gz
gsoc2013-epiphany-1afb0171665b4234ceb57f073a0834b6dc3e005d.tar.zst
gsoc2013-epiphany-1afb0171665b4234ceb57f073a0834b6dc3e005d.zip
ephy-profile-migrator: allow running migration in non-default profile directories
This is necessary since we add new columns to the history database in step 8 of migration. However, non-default profile directories don't have a .migrated file right now but, since up to step 7 it was possible to use these profiles without migration, it is safe to assume that a non-default profile without a .migrated file can be migrated starting from step 8. https://bugzilla.gnome.org/show_bug.cgi?id=681679
-rw-r--r--lib/ephy-profile-migrator.c10
-rw-r--r--lib/ephy-profile-utils.c8
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index 0f4d49938..9acafd7e2 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -53,6 +53,7 @@
static int do_step_n = -1;
static int version = -1;
+static char *profile_dir = NULL;
/*
* What to do to add new migration steps:
@@ -889,6 +890,8 @@ static const GOptionEntry option_entries[] =
N_("Executes only the n-th migration step"), NULL },
{ "version", 'v', 0, G_OPTION_ARG_INT, &version,
N_("Specifies the required version for the migrator"), NULL },
+ { "profile-dir", 'p', 0, G_OPTION_ARG_FILENAME, &profile_dir,
+ N_("Specifies the profile where the migrator should run"), NULL },
{ NULL }
};
@@ -898,6 +901,7 @@ main (int argc, char *argv[])
GOptionContext *option_context;
GOptionGroup *option_group;
GError *error = NULL;
+ EphyFileHelpersFlags file_helpers_flags = EPHY_FILE_HELPERS_NONE;
g_type_init ();
@@ -930,7 +934,11 @@ main (int argc, char *argv[])
ephy_debug_init ();
- if (!ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_NONE, NULL)) {
+ if (profile_dir != NULL)
+ file_helpers_flags = EPHY_FILE_HELPERS_PRIVATE_PROFILE |
+ EPHY_FILE_HELPERS_KEEP_DIR;
+
+ if (!ephy_file_helpers_init (profile_dir, file_helpers_flags, NULL)) {
LOG ("Something wrong happened with ephy_file_helpers_init()");
return -1;
}
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index 829d68925..58abfff61 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -51,6 +51,14 @@ ephy_profile_utils_get_migration_version ()
if (result != 1)
latest = 0;
+ } else if (ephy_dot_dir_is_default () == FALSE) {
+ /* Since version 8, we need to migrate also profile directories
+ other than the default one. Profiles in such directories work
+ perfectly fine without going through the first 7 migration
+ steps, so it is safe to assume that any non-default profile
+ directory without a migration file can be migrated starting
+ from the step 8. */
+ latest = 7;
}
g_free (migrated_file);