[tracker-miners/wip/carlosg/cli-improvements: 29/30] tracker-miner-rss: Specify the ontology correctly




commit 102ccd3879b0bdb81a4ba0b2325a7af79621afc3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Aug 18 10:52:25 2020 +0200

    tracker-miner-rss: Specify the ontology correctly
    
    This broke some time ago it seems, with the addition of the nepomuk
    ontology location helper.

 src/miners/rss/tracker-main.c |  6 ++++--
 src/tracker/tracker-reset.c   | 42 ++++++++++++++++++++----------------------
 2 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/miners/rss/tracker-main.c b/src/miners/rss/tracker-main.c
index 9059240b0..5adca3ce0 100644
--- a/src/miners/rss/tracker-main.c
+++ b/src/miners/rss/tracker-main.c
@@ -91,16 +91,18 @@ setup_connection_and_endpoint (TrackerDomainOntology    *domain,
                                TrackerEndpointDBus     **endpoint,
                                GError                  **error)
 {
-       GFile *cache, *store;
+       GFile *cache, *store, *ontology;
 
        cache = tracker_domain_ontology_get_cache (domain);
        store = g_file_get_child (cache, "rss");
+       ontology = tracker_sparql_get_ontology_nepomuk ();
        *sparql_conn = tracker_sparql_connection_new (get_fts_connection_flags (),
                                                      store,
-                                                     NULL,
+                                                     ontology,
                                                      NULL,
                                                      error);
        g_object_unref (store);
+       g_object_unref (ontology);
 
        if (!*sparql_conn)
                return FALSE;
diff --git a/src/tracker/tracker-reset.c b/src/tracker/tracker-reset.c
index 1359363c1..368ed2a0b 100644
--- a/src/tracker/tracker-reset.c
+++ b/src/tracker/tracker-reset.c
@@ -132,7 +132,7 @@ error:
 }
 
 static void
-delete_databases (GFile *dir)
+delete_location_content (GFile *dir)
 {
        GFileEnumerator *enumerator;
        GError *error = NULL;
@@ -150,26 +150,18 @@ delete_databases (GFile *dir)
        }
 
        while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) {
-               const gchar *name;
                GFile *child;
 
-               name = g_file_info_get_name (info);
+               child = g_file_enumerator_get_child (enumerator, info);
 
-               /* Delete sqlite files in the location */
-               if (g_str_has_suffix (name, ".db") ||
-                   g_str_has_suffix (name, ".db-wal") ||
-                   g_str_has_suffix (name, ".db-shm")) {
-                       child = g_file_enumerator_get_child (enumerator, info);
-
-                       if (!g_file_delete (child, NULL, &error)) {
-                               g_critical ("Failed to delete '%s': %s",
-                                           g_file_info_get_name (info),
-                                           error->message);
-                               g_error_free (error);
-                       }
-
-                       g_object_unref (child);
+               if (!g_file_delete (child, NULL, &error)) {
+                       g_critical ("Failed to delete '%s': %s",
+                                   g_file_info_get_name (info),
+                                   error->message);
+                       g_error_free (error);
                }
+
+               g_object_unref (child);
        }
 
        g_object_unref (enumerator);
@@ -195,13 +187,19 @@ reset_run (void)
        }
 
        if (files) {
-               GFile *cache_location;
+               GFile *location;
                gchar *dir;
 
+               dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "files", "errors", NULL);
+               location = g_file_new_for_path (dir);
+               delete_location_content (location);
+               g_object_unref (location);
+               g_free (dir);
+
                dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "files", NULL);
-               cache_location = g_file_new_for_path (dir);
-               delete_databases (cache_location);
-               g_object_unref (cache_location);
+               location = g_file_new_for_path (dir);
+               delete_location_content (location);
+               g_object_unref (location);
                g_free (dir);
        }
 
@@ -211,7 +209,7 @@ reset_run (void)
 
                dir = g_build_filename (g_get_user_cache_dir (), "tracker3", "rss", NULL);
                cache_location = g_file_new_for_path (dir);
-               delete_databases (cache_location);
+               delete_location_content (cache_location);
                g_object_unref (cache_location);
                g_free (dir);
        }


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