From 5cf504745b07ac017e7c62e83b5efe797d3b74e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= <fred@miniflux.net>
Date: Sat, 30 Jun 2018 14:22:45 -0700
Subject: [PATCH] Add cli flag to reset all feed errors

---
 cli/cli.go      | 6 ++++++
 storage/feed.go | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/cli/cli.go b/cli/cli.go
index 84c06954..4f5417ca 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -23,6 +23,7 @@ func Parse() {
 	flagFlushSessions := flag.Bool("flush-sessions", false, "Flush all sessions (disconnect users)")
 	flagCreateAdmin := flag.Bool("create-admin", false, "Create admin user")
 	flagResetPassword := flag.Bool("reset-password", false, "Reset user password")
+	flagResetFeedErrors := flag.Bool("reset-feed-errors", false, "Clear all feed errors for all users")
 	flagDebugMode := flag.Bool("debug", false, "Enable debug mode (more verbose output)")
 	flag.Parse()
 
@@ -52,6 +53,11 @@ func Parse() {
 		return
 	}
 
+	if *flagResetFeedErrors {
+		store.ResetFeedErrors()
+		return
+	}
+
 	if *flagFlushSessions {
 		flushSessions(store)
 		return
diff --git a/storage/feed.go b/storage/feed.go
index 4c0a6302..326ada87 100644
--- a/storage/feed.go
+++ b/storage/feed.go
@@ -273,3 +273,9 @@ func (s *Storage) RemoveFeed(userID, feedID int64) error {
 
 	return nil
 }
+
+// ResetFeedErrors removes all feed errors.
+func (s *Storage) ResetFeedErrors() error {
+	_, err := s.db.Exec(`UPDATE feeds SET parsing_error_count=0, parsing_error_msg=''`)
+	return err
+}
-- 
GitLab