From 2c9fabd2edcac8727bdbbba72fd2d1cf07aae6da Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:10:47 -0700 Subject: [PATCH 01/18] Remove unused YouMayGetMoreHelpHere method. --- Duplicati/CommandLine/Strings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Duplicati/CommandLine/Strings.cs b/Duplicati/CommandLine/Strings.cs index 5db8812c5..219d06ad1 100644 --- a/Duplicati/CommandLine/Strings.cs +++ b/Duplicati/CommandLine/Strings.cs @@ -31,6 +31,5 @@ namespace Duplicati.CommandLine.Strings { public static string QuietConsoleOptionLong { get { return LC.L(@"If this option is set, progress reports and other messages that would normally go to the console will be redirected to the log."); } } public static string QuietConsoleOptionShort { get { return LC.L(@"Disable console output"); } } public static string SkippingSourceArgumentsOnNonBackupOperation { get { return @"The --source argument was specified in the parameter file, but the current operation is not a backup operation, so the argument is ignored"; } } - public static string YouMayGetMoreHelpHere(string url) { return LC.L(@"This link may provide additional information: {0}", url); } } } From 2ce23c647aad60eec92bbcfb8e6ccd5a56f77d16 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:16:22 -0700 Subject: [PATCH 02/18] Remove unused ConsoleLogTarget class. This was introduced in revision 842fd965439c6f1e6aac2d9ecaedfac1981e16c9 without any apparent usages. --- Duplicati/CommandLine/ConsoleLogTarget.cs | 93 ------------------- .../CommandLine/Duplicati.CommandLine.csproj | 1 - 2 files changed, 94 deletions(-) delete mode 100644 Duplicati/CommandLine/ConsoleLogTarget.cs diff --git a/Duplicati/CommandLine/ConsoleLogTarget.cs b/Duplicati/CommandLine/ConsoleLogTarget.cs deleted file mode 100644 index 297ad1c2d..000000000 --- a/Duplicati/CommandLine/ConsoleLogTarget.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (C) 2018, The Duplicati Team -// http://www.duplicati.com, info@duplicati.com -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.IO; -using Duplicati.Library.Logging; -using Duplicati.Library.Utility; - -namespace Duplicati.CommandLine -{ - /// - /// Log output handler for the console - /// - public class ConsoleLogTarget : Library.Logging.ILogDestination - { - /// - /// The stdout stream - /// - private readonly TextWriter m_stdout; - /// - /// The stderr stream - /// - private readonly TextWriter m_stderr; - /// - /// The default log level - /// - private readonly LogMessageType m_level; - /// - /// The filter, if any - /// - private readonly IFilter m_filter; - - /// - /// Initializes a new instance of the class. - /// - /// The stdout stream. - /// The stderr stream. - /// The minimum log level to consider. - /// The log filter, if any. - public ConsoleLogTarget(TextWriter stdout, TextWriter stderr, LogMessageType level, string logfilter) - { - m_stdout = stdout; - m_stderr = stderr; - m_level = level; - m_filter = FilterExpression.ParseLogFilter(logfilter); - } - - /// - /// Writes the message to stdout or stderr. - /// - /// The entry to write. - public void WriteMessage(LogEntry entry) - { - var found = m_filter.Matches(entry.FilterTag, out var result, out var match); - // If there is a filter match, use that - if (found) - { - if (!result) - return; - - if (entry.Level == LogMessageType.Error) - m_stderr.WriteLine(entry); - else - m_stdout.WriteLine(entry); - } - else - { - // Otherwise, filter by log-level - if (entry.Level < m_level) - return; - } - - if (entry.Level == LogMessageType.Error) - m_stderr.WriteLine(entry.FormattedMessage); - else - m_stdout.WriteLine(entry.FormattedMessage); - - } - } -} diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj index 2b1bff925..ce68ac479 100644 --- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj +++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj @@ -57,7 +57,6 @@ - From 0379eb417e867aa5909955beeab859b7c7b87099 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:35:24 -0700 Subject: [PATCH 03/18] Remove unused ImageToGtk method. --- .../GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs | 55 ++++++++----------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs index 3110fc531..e7ffa992e 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs @@ -1,22 +1,22 @@ -// Copyright (C) 2015, The Duplicati Team -// http://www.duplicati.com, info@duplicati.com -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2015, The Duplicati Team +// http://www.duplicati.com, info@duplicati.com +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #if __MonoCS__ || __WindowsGTK__ || ENABLE_GTK using System; -using System.Collections.Generic; +using System.Collections.Generic; using Duplicati.Library.Common; using Gdk; using Gtk; @@ -162,7 +162,7 @@ namespace Duplicati.GUI.TrayIcon public void SetDefault(bool isDefault) { - // Do nothing. Implementation needed for TrayIconBase interface. + // Do nothing. Implementation needed for TrayIconBase interface. } } @@ -232,17 +232,6 @@ namespace Duplicati.GUI.TrayIcon } } - public static Gtk.Image ImageToGtk(System.Drawing.Image image) - { - using (var stream = new System.IO.MemoryStream()) - { - image.Save(stream, System.Drawing.Imaging.ImageFormat.Png); - stream.Position = 0; - Gtk.Image img = new Gtk.Image(stream); - return img; - } - } - protected static string GetTrayIconFilename(TrayIcons icon) { switch (icon) @@ -304,10 +293,10 @@ namespace Duplicati.GUI.TrayIcon return _images[icon]; } - protected override void SetIcon(TrayIcons icon) - { - m_trayIcon.Pixbuf = GetIcon(icon); - } + protected override void SetIcon(TrayIcons icon) + { + m_trayIcon.Pixbuf = GetIcon(icon); + } protected override void SetMenu (IEnumerable items) From 5edc9f2d136bbc2cc0c4f8d58ad7c3bea3cd1fd9 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:35:42 -0700 Subject: [PATCH 04/18] Remove unused BackkgroundRequest constructor. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 9bd9b4a19..6b74095ba 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; -using Duplicati.Library.Common.IO; +using Duplicati.Library.Common.IO; using Duplicati.Server.Serialization; using Duplicati.Server.Serialization.Interface; @@ -27,10 +27,6 @@ namespace Duplicati.GUI.TrayIcon public string Endpoint; public Dictionary Query; - public BackgroundRequest() - { - } - public BackgroundRequest(string method, string endpoint, Dictionary query) { this.Method = method; From d6688936ed3278c0e654b6a3f5424225d421442b Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:37:10 -0700 Subject: [PATCH 05/18] Remove unused StopTask method. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 6b74095ba..7a0ff4493 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,12 +491,6 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } - public void StopTask(long id) - { - var req = new Dictionary(); - ExecuteAndNotify("POST", string.Format("/task/{0}/stop", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); - } - public void AbortTask(long id) { var req = new Dictionary(); From 523b95abf9c89a3c84b22c01cf757591688fb404 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:37:20 -0700 Subject: [PATCH 06/18] Remove unused AbortTask method. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 7a0ff4493..016918ddb 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,12 +491,6 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } - public void AbortTask(long id) - { - var req = new Dictionary(); - ExecuteAndNotify("POST", string.Format("/task/{0}/abort", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); - } - public void RunBackup(long id, bool forcefull = false) { var req = new Dictionary(); From 3dd4132af1ed863a1529a4762a1f36925f02f509 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:38:27 -0700 Subject: [PATCH 07/18] Remove unused RunBackup method. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 016918ddb..2ebee62d4 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,14 +491,6 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } - public void RunBackup(long id, bool forcefull = false) - { - var req = new Dictionary(); - if (forcefull) - req.Add("full", "true"); - ExecuteAndNotify("POST", string.Format("/backup/{0}/start", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); - } - public void DismissNotification(long id) { var req = new Dictionary(); From 9ab8058354d43565818bf2dc7789cf5ced6b6c95 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:39:43 -0700 Subject: [PATCH 08/18] Remove unused DismissNotification method. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 2ebee62d4..1ae044b67 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,12 +491,6 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } - public void DismissNotification(long id) - { - var req = new Dictionary(); - ExecuteAndNotify("DELETE", string.Format("/notification/{0}", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); - } - public void Dispose() { Close(); From 70be230c29699579d5fc56d4e1fc05365cb55ce0 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 27 Apr 2019 16:42:48 -0700 Subject: [PATCH 09/18] Remove unused IMenuItem.SetEnabled method. --- .../GUI/Duplicati.GUI.TrayIcon/CocoaRunner.cs | 5 ----- .../GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs | 5 ----- .../GUI/Duplicati.GUI.TrayIcon/RumpsRunner.cs | 21 ++++++------------- .../Duplicati.GUI.TrayIcon/TrayIconBase.cs | 1 - .../Duplicati.GUI.TrayIcon/WinFormsRunner.cs | 5 ----- 5 files changed, 6 insertions(+), 31 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/CocoaRunner.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/CocoaRunner.cs index 3dc156deb..2e08c8876 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/CocoaRunner.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/CocoaRunner.cs @@ -68,11 +68,6 @@ namespace Duplicati.GUI.TrayIcon // Do nothing. Implementation needed for IMenuItem interface. } - public void SetEnabled(bool isEnabled) - { - m_item.Enabled = isEnabled; - } - public void SetDefault(bool isDefault) { // Do nothing. Implementation needed for IMenuItem interface. diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs index e7ffa992e..2d6295958 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/GtkRunner.cs @@ -155,11 +155,6 @@ namespace Duplicati.GUI.TrayIcon ((ImageMenuItem) m_item).Image = GetIcon(icon); } - public void SetEnabled(bool isEnabled) - { - m_item.Sensitive = isEnabled; - } - public void SetDefault(bool isDefault) { // Do nothing. Implementation needed for TrayIconBase interface. diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/RumpsRunner.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/RumpsRunner.cs index de7365d67..468af31b6 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/RumpsRunner.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/RumpsRunner.cs @@ -21,8 +21,8 @@ using System.Linq; using System.IO; using System.Threading.Tasks; using CoCoL; -using Duplicati.Library.Common; - +using Duplicati.Library.Common; + namespace Duplicati.GUI.TrayIcon { public class RumpsRunner : TrayIconBase @@ -75,15 +75,6 @@ namespace Duplicati.GUI.TrayIcon } } - public void SetEnabled(bool isEnabled) - { - if (this.Enabled != isEnabled) - { - this.Enabled = isEnabled; - m_parent.UpdateMenu(this); - } - } - public void SetDefault(bool isDefault) { if (this.Default != isDefault) @@ -164,9 +155,9 @@ namespace Duplicati.GUI.TrayIcon var ch = ChannelManager.CreateChannel(); m_toRumps = ch.AsWriteOnly(); - WriteChannel(m_rumpsProcess.StandardInput, ch.AsReadOnly()); - #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed - ReadChannel(m_rumpsProcess.StandardOutput); + WriteChannel(m_rumpsProcess.StandardInput, ch.AsReadOnly()); + #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed + ReadChannel(m_rumpsProcess.StandardOutput); ReadChannel(m_rumpsProcess.StandardError); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed @@ -313,7 +304,7 @@ namespace Duplicati.GUI.TrayIcon if (m_rumpsProcess != null && !m_rumpsProcess.HasExited) { if (m_toRumps != null) - { + { m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new { Action = "shutdown" })); m_toRumps.Dispose(); m_toRumps = null; diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/TrayIconBase.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/TrayIconBase.cs index 1a96389c7..47734f84e 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/TrayIconBase.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/TrayIconBase.cs @@ -56,7 +56,6 @@ namespace Duplicati.GUI.TrayIcon public interface IMenuItem { void SetDefault(bool isDefault); - void SetEnabled(bool isEnabled); void SetIcon(MenuIcons icon); void SetText(string text); } diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs index f47693229..a9ce14aeb 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs @@ -88,11 +88,6 @@ namespace Duplicati.GUI.TrayIcon.Windows m_menu.Image = GetIcon(icon); } - public void SetEnabled(bool isEnabled) - { - m_menu.Enabled = isEnabled; - } - public void SetDefault(bool value) { m_menu.Font = new System.Drawing.Font(m_menu.Font, System.Drawing.FontStyle.Bold); From ffaaa55f2f2b44e8a60d06d3222e1ff3c3a0a9bb Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Sat, 4 May 2019 16:34:36 -0700 Subject: [PATCH 10/18] Use AsyncHttpRequest to handle async HttpWebRequests. For some reason, when using HttpWebRequest.GetRequestStreamAsync, the Amazon Cloud Drive and Box backends would fail when attempting to upload larger amounts of data (these are the only backends that use the PostMultipartAsync method). This fixes issue #3756. --- Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs | 2 +- Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs index 41b4bfa29..98ee79afd 100644 --- a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs +++ b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using Duplicati.Library.Common.IO; +using Duplicati.Library.Common.IO; using Duplicati.Library.Interface; using Newtonsoft.Json; using System; diff --git a/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs b/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs index dbe43c18c..ef5e13a3e 100644 --- a/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs +++ b/Duplicati/Library/Backend/OAuthHelper/JSONWebHelper.cs @@ -134,9 +134,10 @@ namespace Duplicati.Library CreateBoundary(out var boundary, out var bodyTerminator); var req = PreparePostMultipart(url, setup, boundary, bodyTerminator, out var headers, parts); + var areq = new AsyncHttpRequest(req); var buffer = new byte[Utility.Utility.DEFAULT_BUFFER_SIZE]; - using (var rs = await req.GetRequestStreamAsync().ConfigureAwait(false)) + using (var rs = areq.GetRequestStream()) { foreach (var p in headers) { From 3c986a3fe5573061afdd9b3ba736ce28bb0a7a3e Mon Sep 17 00:00:00 2001 From: Rune Henriksen Date: Sun, 5 May 2019 02:20:32 +0200 Subject: [PATCH 11/18] Check the block size to avoid scavenging behavoir when Duplicati can't locate the 'empty' block which doesn't exist --- Duplicati/Library/Main/Database/LocalRecreateDatabase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/Main/Database/LocalRecreateDatabase.cs b/Duplicati/Library/Main/Database/LocalRecreateDatabase.cs index fd64b47cc..769025026 100644 --- a/Duplicati/Library/Main/Database/LocalRecreateDatabase.cs +++ b/Duplicati/Library/Main/Database/LocalRecreateDatabase.cs @@ -498,8 +498,8 @@ namespace Duplicati.Library.Main.Database blocksize / hashsize ); - var missingBlockInfo = - @"SELECT ""VolumeID"" FROM ""Block"" WHERE ""VolumeID"" < 0 "; + var missingBlockInfo = + @"SELECT ""VolumeID"" FROM ""Block"" WHERE ""VolumeID"" < 0 AND SIZE > 0"; var missingBlocklistVolumes = string.Format( @"SELECT ""VolumeID"" FROM ""Block"", (" + From 155123d22a6988c19696b6a86ad275a192e48852 Mon Sep 17 00:00:00 2001 From: Rune Henriksen Date: Sun, 5 May 2019 23:33:50 +0200 Subject: [PATCH 12/18] added boolean check to make the json output use the subject template instead of always returning the result as a json payload --- Duplicati/Library/Modules/Builtin/ReportHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Duplicati/Library/Modules/Builtin/ReportHelper.cs b/Duplicati/Library/Modules/Builtin/ReportHelper.cs index f6bdc1274..ca83f31bc 100644 --- a/Duplicati/Library/Modules/Builtin/ReportHelper.cs +++ b/Duplicati/Library/Modules/Builtin/ReportHelper.cs @@ -292,7 +292,7 @@ namespace Duplicati.Library.Modules.Builtin protected virtual string ReplaceTemplate(string input, object result, bool subjectline) { // For JSON, ignore the template and just use the contents - if (ExportFormat == ResultExportFormat.Json) + if (ExportFormat == ResultExportFormat.Json && !subjectline) { var extra = new Dictionary(); From 246071b6ba2c1212b4d037aba9028793aa5b69b2 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:00:34 -0700 Subject: [PATCH 13/18] Revert "Remove unused YouMayGetMoreHelpHere method." This reverts commit 2c9fabd2edcac8727bdbbba72fd2d1cf07aae6da. This is a placeholder message that is intended to be used with the code for each error and log message. The idea is that the commandline will use the code to provide a link to the forum, searching for the code, such that it is easy to maintain a list of help links. --- Duplicati/CommandLine/Strings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Duplicati/CommandLine/Strings.cs b/Duplicati/CommandLine/Strings.cs index 219d06ad1..5db8812c5 100644 --- a/Duplicati/CommandLine/Strings.cs +++ b/Duplicati/CommandLine/Strings.cs @@ -31,5 +31,6 @@ namespace Duplicati.CommandLine.Strings { public static string QuietConsoleOptionLong { get { return LC.L(@"If this option is set, progress reports and other messages that would normally go to the console will be redirected to the log."); } } public static string QuietConsoleOptionShort { get { return LC.L(@"Disable console output"); } } public static string SkippingSourceArgumentsOnNonBackupOperation { get { return @"The --source argument was specified in the parameter file, but the current operation is not a backup operation, so the argument is ignored"; } } + public static string YouMayGetMoreHelpHere(string url) { return LC.L(@"This link may provide additional information: {0}", url); } } } From f4c886e8f8fbe57d9b4d0638c0bf6b821d124048 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:03:21 -0700 Subject: [PATCH 14/18] Add comment to explain unused method. --- Duplicati/CommandLine/Strings.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Duplicati/CommandLine/Strings.cs b/Duplicati/CommandLine/Strings.cs index 5db8812c5..5f47b9272 100644 --- a/Duplicati/CommandLine/Strings.cs +++ b/Duplicati/CommandLine/Strings.cs @@ -31,6 +31,13 @@ namespace Duplicati.CommandLine.Strings { public static string QuietConsoleOptionLong { get { return LC.L(@"If this option is set, progress reports and other messages that would normally go to the console will be redirected to the log."); } } public static string QuietConsoleOptionShort { get { return LC.L(@"Disable console output"); } } public static string SkippingSourceArgumentsOnNonBackupOperation { get { return @"The --source argument was specified in the parameter file, but the current operation is not a backup operation, so the argument is ignored"; } } + + + // ReSharper disable once UnusedMember.Global + // This is a placeholder message that is intended to be used with the code + // for each error and log message. The idea is that the commandline will + // use the code to provide a link to the forum, searching for the code, + // such that it is easy to maintain a list of help links. public static string YouMayGetMoreHelpHere(string url) { return LC.L(@"This link may provide additional information: {0}", url); } } } From bc1ac322f8cfb664567ed180c51bc067cddf4b58 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:13:01 -0700 Subject: [PATCH 15/18] Revert "Remove unused DismissNotification method." This reverts commit 9ab8058354d43565818bf2dc7789cf5ced6b6c95. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 1ae044b67..2ebee62d4 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,6 +491,12 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } + public void DismissNotification(long id) + { + var req = new Dictionary(); + ExecuteAndNotify("DELETE", string.Format("/notification/{0}", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); + } + public void Dispose() { Close(); From 8f19322657524d84309575478f1cb0c5574894e4 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:13:03 -0700 Subject: [PATCH 16/18] Revert "Remove unused RunBackup method." This reverts commit 3dd4132af1ed863a1529a4762a1f36925f02f509. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 2ebee62d4..016918ddb 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,6 +491,14 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } + public void RunBackup(long id, bool forcefull = false) + { + var req = new Dictionary(); + if (forcefull) + req.Add("full", "true"); + ExecuteAndNotify("POST", string.Format("/backup/{0}/start", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); + } + public void DismissNotification(long id) { var req = new Dictionary(); From e3d04dd5f1aa12d80cc62f198b789deb9133acc8 Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:13:03 -0700 Subject: [PATCH 17/18] Revert "Remove unused AbortTask method." This reverts commit 523b95abf9c89a3c84b22c01cf757591688fb404. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 016918ddb..7a0ff4493 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,6 +491,12 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } + public void AbortTask(long id) + { + var req = new Dictionary(); + ExecuteAndNotify("POST", string.Format("/task/{0}/abort", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); + } + public void RunBackup(long id, bool forcefull = false) { var req = new Dictionary(); From d26d538b22e6ef608508bd9d2b311db153b3930d Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 6 May 2019 20:13:04 -0700 Subject: [PATCH 18/18] Revert "Remove unused StopTask method." This reverts commit d6688936ed3278c0e654b6a3f5424225d421442b. --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 7a0ff4493..6b74095ba 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -491,6 +491,12 @@ namespace Duplicati.GUI.TrayIcon ExecuteAndNotify("POST", "/serverstate/resume", req); } + public void StopTask(long id) + { + var req = new Dictionary(); + ExecuteAndNotify("POST", string.Format("/task/{0}/stop", Library.Utility.Uri.UrlPathEncode(id.ToString())), req); + } + public void AbortTask(long id) { var req = new Dictionary();