[epiphany] adblock: Add profile migration to remove per-profile directory
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] adblock: Add profile migration to remove per-profile directory
- Date: Mon, 9 Sep 2019 19:23:31 +0000 (UTC)
commit 3eb29c4061af33e41b8a5bc682a63d89a94c5fa5
Author: Adrian Perez de Castro <aperez igalia com>
Date: Mon Sep 9 00:24:22 2019 +0300
adblock: Add profile migration to remove per-profile directory
With the adblock/ subdirectory being now in the shared per-user cache
directory, the per-profile one is not needed anymore and needs to be
removed.
lib/ephy-profile-utils.h | 2 +-
src/profile-migrator/ephy-profile-migrator.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 07926d226..b01e842d2 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
-#define EPHY_PROFILE_MIGRATION_VERSION 33
+#define EPHY_PROFILE_MIGRATION_VERSION 34
#define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
#define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19
#define EPHY_TARGET_ORIGIN_MIGRATION_VERSION 21
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index b7dcdaec8..87a35d043 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1267,6 +1267,21 @@ migrate_adblock_to_content_filters (void)
g_settings_reset (EPHY_SETTINGS_MAIN, "adblock-filters");
}
+static void
+migrate_adblock_to_shared_cache_dir (void)
+{
+ /* Remove the adblock/ subdirectory from the profile directory. During
+ * startup Epiphany will create the new directory under the shared cache
+ * data directory itself.
+ */
+ g_autofree char *directory = g_build_filename (ephy_cache_dir (), "adblock", NULL);
+
+ g_autoptr (GError) error = NULL;
+ if (!ephy_file_delete_dir_recursively (directory, &error) &&
+ !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ g_warning ("Cannot delete adblock directory %s: %s", directory, error->message);
+}
+
static void
migrate_nothing (void)
{
@@ -1315,6 +1330,7 @@ const EphyProfileMigrator migrators[] = {
/* 31 */ migrate_web_extension_config_dir,
/* 32 */ migrate_webapps_harder,
/* 33 */ migrate_adblock_to_content_filters,
+ /* 34 */ migrate_adblock_to_shared_cache_dir,
};
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]