Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Duplicati/CommandLine/Commands.cs5
-rw-r--r--Duplicati/CommandLine/ConsoleOutput.cs2
-rw-r--r--Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs2
-rw-r--r--Duplicati/Library/Compression/FileArchiveZip.cs2
-rw-r--r--Duplicati/Library/DynamicLoader/DynamicLoader.cs2
-rw-r--r--Duplicati/Library/Logging/Log.cs2
-rw-r--r--Duplicati/Library/Main/BackendManager.cs2
-rw-r--r--Duplicati/Library/Main/Options.cs15
-rw-r--r--Duplicati/Library/Main/Strings.cs2
-rw-r--r--Duplicati/Library/Utility/BlockingQueue.cs2
-rw-r--r--Duplicati/Library/Utility/DirectStreamLink.cs2
-rw-r--r--Duplicati/Library/Utility/FilterExpression.cs2
-rw-r--r--Duplicati/Library/Utility/TempFile.cs2
-rw-r--r--Duplicati/Library/Utility/WorkerThread.cs2
-rw-r--r--Duplicati/Server/EventPollNotify.cs2
-rw-r--r--Duplicati/Server/LiveControls.cs2
-rw-r--r--Duplicati/Server/LogWriteHandler.cs4
-rw-r--r--Duplicati/Server/Program.cs2
-rw-r--r--Duplicati/Server/Runner.cs6
-rw-r--r--Duplicati/Server/Scheduler.cs17
-rw-r--r--Duplicati/Server/UpdatePollThread.cs2
-rw-r--r--Duplicati/Server/WebServer/RESTMethods/Captcha.cs2
-rw-r--r--Duplicati/Service/Runner.cs2
-rw-r--r--README.md2
24 files changed, 59 insertions, 26 deletions
diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs
index a4bb1fe08..fe0d473c0 100644
--- a/Duplicati/CommandLine/Commands.cs
+++ b/Duplicati/CommandLine/Commands.cs
@@ -545,6 +545,11 @@ namespace Duplicati.CommandLine
{
using (var periodicOutput = new PeriodicOutput(output, TimeSpan.FromSeconds(5)))
{
+ if ((new Duplicati.Library.Main.Options(options)).DisableOnBattery && (Duplicati.Library.Utility.Power.PowerSupply.GetSource() == Duplicati.Library.Utility.Power.PowerSupply.Source.Battery))
+ {
+ output.MessageEvent("The \"disable-on-battery\" option only affects scheduled backups and is ignored by backups run manually or from the command line.");
+ }
+
output.MessageEvent(string.Format("Backup started at {0}", DateTime.Now));
output.PhaseChanged += (phase, previousPhase) =>
diff --git a/Duplicati/CommandLine/ConsoleOutput.cs b/Duplicati/CommandLine/ConsoleOutput.cs
index 1dbd53674..6ff5814aa 100644
--- a/Duplicati/CommandLine/ConsoleOutput.cs
+++ b/Duplicati/CommandLine/ConsoleOutput.cs
@@ -24,7 +24,7 @@ namespace Duplicati.CommandLine
{
public class ConsoleOutput : Library.Main.IMessageSink, IDisposable
{
- private object m_lock = new object();
+ private readonly object m_lock = new object();
public bool QuietConsole { get; private set; }
public bool VerboseErrors { get; private set; }
diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs
index 77eeb9d4e..3c8eb53bd 100644
--- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs
+++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs
@@ -67,7 +67,7 @@ namespace Duplicati.GUI.TrayIcon
public IServerStatus Status { get { return m_status; } }
- private object m_lock = new object();
+ private readonly object m_lock = new object();
private Queue<BackgroundRequest> m_workQueue = new Queue<BackgroundRequest>();
public HttpServerConnection(Uri server, string password, bool saltedpassword, Program.PasswordSource passwordSource, Dictionary<string, string> options)
diff --git a/Duplicati/Library/Compression/FileArchiveZip.cs b/Duplicati/Library/Compression/FileArchiveZip.cs
index 18ac5a881..33c78e77c 100644
--- a/Duplicati/Library/Compression/FileArchiveZip.cs
+++ b/Duplicati/Library/Compression/FileArchiveZip.cs
@@ -33,7 +33,7 @@ namespace Duplicati.Library.Compression
{
/// <summary>
/// An abstraction of a zip archive as a FileArchive, based on SharpCompress.
- /// Please note, duplicati does not require both Read & Write access at the same time so this has not been implemented.
+ /// Please note, duplicati does not require both Read &amp; Write access at the same time so this has not been implemented.
/// </summary>
public class FileArchiveZip : ICompression
{
diff --git a/Duplicati/Library/DynamicLoader/DynamicLoader.cs b/Duplicati/Library/DynamicLoader/DynamicLoader.cs
index fa208e61d..26f243d95 100644
--- a/Duplicati/Library/DynamicLoader/DynamicLoader.cs
+++ b/Duplicati/Library/DynamicLoader/DynamicLoader.cs
@@ -37,7 +37,7 @@ namespace Duplicati.Library.DynamicLoader
/// <summary>
/// A lock used to guarantee threadsafe access to the interface lookup table
/// </summary>
- protected object m_lock = new object();
+ protected readonly object m_lock = new object();
/// <summary>
/// A cached list of interfaces
diff --git a/Duplicati/Library/Logging/Log.cs b/Duplicati/Library/Logging/Log.cs
index 0ec235b98..7346a95f4 100644
--- a/Duplicati/Library/Logging/Log.cs
+++ b/Duplicati/Library/Logging/Log.cs
@@ -85,7 +85,7 @@ namespace Duplicati.Library.Logging
/// <summary>
/// Static lock object to provide thread safe logging
/// </summary>
- private static object m_lock = new object();
+ private static readonly object m_lock = new object();
/// <summary>
/// Gets the lock instance used to protect the logging calls
diff --git a/Duplicati/Library/Main/BackendManager.cs b/Duplicati/Library/Main/BackendManager.cs
index 32baae6b1..19c42d5ed 100644
--- a/Duplicati/Library/Main/BackendManager.cs
+++ b/Duplicati/Library/Main/BackendManager.cs
@@ -244,7 +244,7 @@ namespace Duplicati.Library.Main
private class DatabaseCollector
{
- private object m_dbqueuelock = new object();
+ private readonly object m_dbqueuelock = new object();
private LocalDatabase m_database;
private System.Threading.Thread m_callerThread;
private List<IDbEntry> m_dbqueue;
diff --git a/Duplicati/Library/Main/Options.cs b/Duplicati/Library/Main/Options.cs
index 97b655ac0..d28ac6161 100644
--- a/Duplicati/Library/Main/Options.cs
+++ b/Duplicati/Library/Main/Options.cs
@@ -188,7 +188,7 @@ namespace Duplicati.Library.Main
/// <summary>
/// Lock that protects the options collection
/// </summary>
- protected object m_lock = new object();
+ protected readonly object m_lock = new object();
protected Dictionary<string, string> m_options;
@@ -257,7 +257,8 @@ namespace Duplicati.Library.Main
"compression-extension-file",
"full-remote-verification",
"disable-synthetic-filelist",
- "disable-file-scanner"
+ "disable-file-scanner",
+ "disable-on-battery"
};
}
}
@@ -543,6 +544,7 @@ namespace Duplicati.Library.Main
new CommandLineArgument("auto-vacuum", CommandLineArgument.ArgumentType.Boolean, Strings.Options.AutoVacuumShort, Strings.Options.AutoVacuumLong, "false"),
new CommandLineArgument("disable-file-scanner", CommandLineArgument.ArgumentType.Boolean, Strings.Options.DisablefilescannerShort, Strings.Options.DisablefilescannerLong, "false"),
+ new CommandLineArgument("disable-on-battery", CommandLineArgument.ArgumentType.Boolean, Strings.Options.DisableOnBatteryShort, Strings.Options.DisableOnBatteryLong, "false"),
});
return lst;
@@ -1891,6 +1893,15 @@ namespace Duplicati.Library.Main
}
/// <summary>
+ /// Gets a flag indicating whether the backup should be disabled when on battery power.
+ /// </summary>
+ /// <value><c>true</c> if the backup should be disabled when on battery power; otherwise, <c>false</c>.</value>
+ public bool DisableOnBattery
+ {
+ get { return Library.Utility.Utility.ParseBoolOption(m_options, "disable-on-battery"); }
+ }
+
+ /// <summary>
/// Gets the threshold for when log data should be cleaned
/// </summary>
public DateTime LogRetention
diff --git a/Duplicati/Library/Main/Strings.cs b/Duplicati/Library/Main/Strings.cs
index eda86d99c..c3f0562cd 100644
--- a/Duplicati/Library/Main/Strings.cs
+++ b/Duplicati/Library/Main/Strings.cs
@@ -242,6 +242,8 @@ namespace Duplicati.Library.Main.Strings
public static string AutoVacuumLong { get { return LC.L(@"Some operations that manipulate the local database leave unused entries behind. These entries are not deleted from a hard drive until a VACUUM operation is run. This operation saves disk space in the long run but needs to temporarily create a copy of all valid entries in the database. Setting this to true will allow Duplicati to perform VACUUM operations at its discretion."); } }
public static string DisablefilescannerShort { get { return LC.L(@"Disable the read-ahead scanner"); } }
public static string DisablefilescannerLong { get { return LC.L(@"When this flag is enabled, the scanner that computes the size of source files is disabled, and instead the reported size is read from the database. Using this flag can speed up the backup by reducing disk access, but will give a less accurate progress indicator."); } }
+ public static string DisableOnBatteryShort { get { return LC.L("Disable the backup when on battery power"); } }
+ public static string DisableOnBatteryLong { get { return LC.L("When this flag is enabled, a scheduled backup will not run if the system is detected to be running on battery power (manual or command line backups will still be run). If the detected power source is mains (i.e., AC) or unknown, then scheduled backups will proceed as normal."); } }
public static string LogfileloglevelLong { get { return LC.L(@"Specifies the amount of log information to write into the file specified by --log-file"); } }
public static string LogfileloglevelShort { get { return LC.L(@"Log file information level"); } }
diff --git a/Duplicati/Library/Utility/BlockingQueue.cs b/Duplicati/Library/Utility/BlockingQueue.cs
index 02a9b8e37..5a057f489 100644
--- a/Duplicati/Library/Utility/BlockingQueue.cs
+++ b/Duplicati/Library/Utility/BlockingQueue.cs
@@ -115,7 +115,7 @@ namespace Duplicati.Library.Utility
/// <summary>
/// The lock that protects the data structures
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary>
/// The queue storing the elements produced
/// </summary>
diff --git a/Duplicati/Library/Utility/DirectStreamLink.cs b/Duplicati/Library/Utility/DirectStreamLink.cs
index e0fe8c1c6..32dbb63a2 100644
--- a/Duplicati/Library/Utility/DirectStreamLink.cs
+++ b/Duplicati/Library/Utility/DirectStreamLink.cs
@@ -41,7 +41,7 @@ namespace Duplicati.Library.Utility
/// Used to protect accesses to all state vars and making decisions
/// on blocking thereon.
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary> An event to wake reader. </summary>
private ManualResetEventSlim m_signalDataAvailable = new ManualResetEventSlim(false);
diff --git a/Duplicati/Library/Utility/FilterExpression.cs b/Duplicati/Library/Utility/FilterExpression.cs
index 77fe3054a..e03139b93 100644
--- a/Duplicati/Library/Utility/FilterExpression.cs
+++ b/Duplicati/Library/Utility/FilterExpression.cs
@@ -375,7 +375,7 @@ namespace Duplicati.Library.Utility
/// <summary>
/// The lock object for protecting access to the lookup table
/// </summary>
- private static object _matchLock = new object();
+ private readonly static object _matchLock = new object();
/// <summary>
/// Utility function to match a filter with a default fall-through value
diff --git a/Duplicati/Library/Utility/TempFile.cs b/Duplicati/Library/Utility/TempFile.cs
index a1750833a..ba7a49706 100644
--- a/Duplicati/Library/Utility/TempFile.cs
+++ b/Duplicati/Library/Utility/TempFile.cs
@@ -38,7 +38,7 @@ namespace Duplicati.Library.Utility
#if DEBUG
//In debug mode, we track the creation of temporary files, and encode the generating method into the name
- private static object m_lock = new object();
+ private static readonly object m_lock = new object();
private static Dictionary<string, System.Diagnostics.StackTrace> m_fileTrace = new Dictionary<string, System.Diagnostics.StackTrace>();
public static System.Diagnostics.StackTrace GetStackTraceForTempFile(string filename)
diff --git a/Duplicati/Library/Utility/WorkerThread.cs b/Duplicati/Library/Utility/WorkerThread.cs
index ee4bd9b2e..cff4219fc 100644
--- a/Duplicati/Library/Utility/WorkerThread.cs
+++ b/Duplicati/Library/Utility/WorkerThread.cs
@@ -33,7 +33,7 @@ namespace Duplicati.Library.Utility
/// <summary>
/// Locking object for shared data
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary>
/// The wait event
/// </summary>
diff --git a/Duplicati/Server/EventPollNotify.cs b/Duplicati/Server/EventPollNotify.cs
index 2004aa00a..83e853252 100644
--- a/Duplicati/Server/EventPollNotify.cs
+++ b/Duplicati/Server/EventPollNotify.cs
@@ -13,7 +13,7 @@ namespace Duplicati.Server
/// <summary>
/// The lock that grants exclusive access to control structures
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary>
/// The current eventID
/// </summary>
diff --git a/Duplicati/Server/LiveControls.cs b/Duplicati/Server/LiveControls.cs
index 3a08d0c09..cfb835e3f 100644
--- a/Duplicati/Server/LiveControls.cs
+++ b/Duplicati/Server/LiveControls.cs
@@ -102,7 +102,7 @@ namespace Duplicati.Server
/// <summary>
/// The object that ensures concurrent operations
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary>
/// Gets the current overridden thread priority
diff --git a/Duplicati/Server/LogWriteHandler.cs b/Duplicati/Server/LogWriteHandler.cs
index ec661657a..c4519c96e 100644
--- a/Duplicati/Server/LogWriteHandler.cs
+++ b/Duplicati/Server/LogWriteHandler.cs
@@ -143,7 +143,7 @@ namespace Duplicati.Server
private int m_tail;
private int m_length;
private int m_key;
- private object m_lock = new object();
+ private readonly object m_lock = new object();
public RingBuffer(int size, IEnumerable<T> initial = null)
{
@@ -227,7 +227,7 @@ namespace Duplicati.Server
}
private DateTime[] m_timeouts;
- private object m_lock = new object();
+ private readonly object m_lock = new object();
private volatile bool m_anytimeouts = false;
private RingBuffer<LogEntry> m_buffer;
diff --git a/Duplicati/Server/Program.cs b/Duplicati/Server/Program.cs
index a6f0572e3..177d6fd4e 100644
--- a/Duplicati/Server/Program.cs
+++ b/Duplicati/Server/Program.cs
@@ -44,7 +44,7 @@ namespace Duplicati.Server
/// <summary>
/// This is the lock to be used before manipulating the shared resources
/// </summary>
- public static object MainLock = new object();
+ public static readonly object MainLock = new object();
/// <summary>
/// This is the scheduling thread
diff --git a/Duplicati/Server/Runner.cs b/Duplicati/Server/Runner.cs
index d7359bebf..a6f5605f4 100644
--- a/Duplicati/Server/Runner.cs
+++ b/Duplicati/Server/Runner.cs
@@ -264,7 +264,7 @@ namespace Duplicati.Server
private ProgressState m_state;
private Duplicati.Library.Main.IBackendProgress m_backendProgress;
private Duplicati.Library.Main.IOperationProgress m_operationProgress;
- private object m_lock = new object();
+ private readonly object m_lock = new object();
public MessageSink(long taskId, string backupId)
{
@@ -843,7 +843,7 @@ namespace Duplicati.Server
options["disable-module"] = string.Join(",", mods.Union(new string[] { module }).Distinct(StringComparer.OrdinalIgnoreCase));
}
- private static Dictionary<string, string> ApplyOptions(Duplicati.Server.Serialization.Interface.IBackup backup, DuplicatiOperation mode, Dictionary<string, string> options)
+ internal static Dictionary<string, string> ApplyOptions(Duplicati.Server.Serialization.Interface.IBackup backup, DuplicatiOperation mode, Dictionary<string, string> options)
{
options["backup-name"] = backup.Name;
options["dbpath"] = backup.DBPath;
@@ -891,7 +891,7 @@ namespace Duplicati.Server
return filter;
}
- private static Dictionary<string, string> GetCommonOptions(Duplicati.Server.Serialization.Interface.IBackup backup, DuplicatiOperation mode)
+ internal static Dictionary<string, string> GetCommonOptions(Duplicati.Server.Serialization.Interface.IBackup backup, DuplicatiOperation mode)
{
return
(from n in Program.DataConnection.Settings
diff --git a/Duplicati/Server/Scheduler.cs b/Duplicati/Server/Scheduler.cs
index 41325f70a..fb01df458 100644
--- a/Duplicati/Server/Scheduler.cs
+++ b/Duplicati/Server/Scheduler.cs
@@ -34,6 +34,8 @@ namespace Duplicati.Server
/// </summary>
public class Scheduler
{
+ private static readonly string LOGTAG = Duplicati.Library.Logging.Log.LogTagFromType<Scheduler>();
+
/// <summary>
/// The thread that runs the scheduler
/// </summary>
@@ -53,7 +55,7 @@ namespace Duplicati.Server
/// <summary>
/// The data syncronization lock
/// </summary>
- private object m_lock = new object();
+ private readonly object m_lock = new object();
/// <summary>
/// An event that is raised when the schedule changes
@@ -278,7 +280,18 @@ namespace Duplicati.Server
{
var entry = Program.DataConnection.GetBackup(id);
if (entry != null)
- jobsToRun.Add(Server.Runner.CreateTask(Duplicati.Server.Serialization.DuplicatiOperation.Backup, entry));
+ {
+ Dictionary<string, string> options = Duplicati.Server.Runner.GetCommonOptions(entry, Duplicati.Server.Serialization.DuplicatiOperation.Backup);
+ Duplicati.Server.Runner.ApplyOptions(entry, Duplicati.Server.Serialization.DuplicatiOperation.Backup, options);
+ if ((new Duplicati.Library.Main.Options(options)).DisableOnBattery && (Duplicati.Library.Utility.Power.PowerSupply.GetSource() == Duplicati.Library.Utility.Power.PowerSupply.Source.Battery))
+ {
+ Duplicati.Library.Logging.Log.WriteInformationMessage(LOGTAG, "BackupDisabledOnBattery", "Scheduled backup disabled while on battery power.");
+ }
+ else
+ {
+ jobsToRun.Add(Server.Runner.CreateTask(Duplicati.Server.Serialization.DuplicatiOperation.Backup, entry));
+ }
+ }
}
}
diff --git a/Duplicati/Server/UpdatePollThread.cs b/Duplicati/Server/UpdatePollThread.cs
index 8ece886d1..f913a60a6 100644
--- a/Duplicati/Server/UpdatePollThread.cs
+++ b/Duplicati/Server/UpdatePollThread.cs
@@ -31,7 +31,7 @@ namespace Duplicati.Server
private volatile bool m_terminated = false;
private volatile bool m_download = false;
private volatile bool m_forceCheck = false;
- private object m_lock = new object();
+ private readonly object m_lock = new object();
private AutoResetEvent m_waitSignal;
private double m_downloadProgress;
diff --git a/Duplicati/Server/WebServer/RESTMethods/Captcha.cs b/Duplicati/Server/WebServer/RESTMethods/Captcha.cs
index ac4bec06a..bd7ad5d5d 100644
--- a/Duplicati/Server/WebServer/RESTMethods/Captcha.cs
+++ b/Duplicati/Server/WebServer/RESTMethods/Captcha.cs
@@ -38,7 +38,7 @@ namespace Duplicati.Server.WebServer.RESTMethods
}
}
- private static object m_lock = new object();
+ private static readonly object m_lock = new object();
private static Dictionary<string, CaptchaEntry> m_captchas = new Dictionary<string, CaptchaEntry>();
public static bool SolvedCaptcha(string token, string target, string answer)
diff --git a/Duplicati/Service/Runner.cs b/Duplicati/Service/Runner.cs
index ae4300815..c45bb458b 100644
--- a/Duplicati/Service/Runner.cs
+++ b/Duplicati/Service/Runner.cs
@@ -30,7 +30,7 @@ namespace Duplicati.Service
private Action m_onStoppedAction;
private Action<string, bool> m_reportMessage;
- private object m_writelock = new object();
+ private readonly object m_writelock = new object();
private readonly string[] m_cmdargs;
diff --git a/README.md b/README.md
index 6cd8b1c36..5a996d7bf 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,8 @@ Support
Duplicati is supported by an [active community and you can reach them via our forum](https://forum.duplicati.com).
+We have a great [Duplicati manual](https://docs.duplicati.com) that you can also [contribute to](https://github.com/kees-z/DuplicatiDocs).
+
Features
========