[epiphany/mcatanzaro/webapp-profile: 9/19] Set current migration version when creating web apps
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/webapp-profile: 9/19] Set current migration version when creating web apps
- Date: Wed, 20 Mar 2019 14:39:16 +0000 (UTC)
commit fee6f90643125e8e96e75c078b1eb73b6be24b1e
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sat Mar 16 13:10:56 2019 -0500
Set current migration version when creating web apps
Running migration is very slow, and it's not needed at all for
newly-created web apps, so let's create the .migrated file along with
the web app and skip migration altogether.
lib/ephy-profile-utils.c | 13 ++++++++++---
lib/ephy-profile-utils.h | 1 +
lib/ephy-web-app-utils.c | 4 ++++
3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index 87384631a..6c9c4546f 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -64,12 +64,13 @@ ephy_profile_utils_get_migration_version (void)
}
gboolean
-ephy_profile_utils_set_migration_version (int version)
+ephy_profile_utils_set_migration_version_for_profile_dir (int version,
+ const char *profile_directory)
{
char *migrated_file, *contents;
gboolean result = FALSE;
- migrated_file = g_build_filename (ephy_profile_dir (),
+ migrated_file = g_build_filename (profile_directory,
PROFILE_MIGRATION_FILE,
NULL);
contents = g_strdup_printf ("%d", version);
@@ -77,7 +78,7 @@ ephy_profile_utils_set_migration_version (int version)
if (result == FALSE)
LOG ("Couldn't store migration version %d in %s (%s, %s)",
- version, migrated_file, ephy_profile_dir (), PROFILE_MIGRATION_FILE);
+ version, migrated_file, profile_directory, PROFILE_MIGRATION_FILE);
g_free (contents);
g_free (migrated_file);
@@ -85,6 +86,12 @@ ephy_profile_utils_set_migration_version (int version)
return result;
}
+gboolean
+ephy_profile_utils_set_migration_version (int version)
+{
+ return ephy_profile_utils_set_migration_version_for_profile_dir (version, ephy_profile_dir ());
+}
+
#define EPHY_PROFILE_MIGRATOR "ephy-profile-migrator"
gboolean
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 25076d073..af1c2d472 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -40,6 +40,7 @@ int ephy_profile_utils_get_migration_version (void);
int ephy_profile_utils_get_migration_version_for_profile_dir (const char *profile_directory);
gboolean ephy_profile_utils_set_migration_version (int version);
+gboolean ephy_profile_utils_set_migration_version_for_profile_dir (int version, const char
*profile_directory);
gboolean ephy_profile_utils_do_migration (const char *profile_directory, int test_to_run, gboolean debug);
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index a1eab2668..a362fb91b 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -23,6 +23,7 @@
#include "ephy-debug.h"
#include "ephy-file-helpers.h"
+#include "ephy-profile-utils.h"
#include "ephy-settings.h"
#include <errno.h>
@@ -390,6 +391,9 @@ ephy_web_application_create (const char *id,
goto out;
}
+ /* Skip migration for new web apps. */
+ ephy_profile_utils_set_migration_version_for_profile_dir (EPHY_PROFILE_MIGRATION_VERSION, profile_dir);
+
/* Create an .app file. */
g_autofree char *app_file = g_build_filename (profile_dir, ".app", NULL);
int fd = g_open (app_file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]