Carl Johnsen
34ec5323d2
Accidentially changed the name of the environment variable for custom SQLite options
2025-07-10 15:22:28 +02:00
Kenneth Skovhede
cfb1fec331
Fixed compile issue
2025-07-04 16:29:30 +02:00
Carl Johnsen
322e4f15e4
Implemented a lightweight parser to the CUSTOMSQLITEOPTIONS environment variable along with new default options.
2025-06-19 11:48:05 +02:00
Carl Johnsen
2412800c0c
Removed the sqlite page cache option. It should be set through the environment variable, or some other way of providing a custom database configurotion
2025-06-19 11:41:39 +02:00
Carl Johnsen
baab370046
Added the final docstrings
2025-06-18 08:26:20 +02:00
Carl Johnsen
3d11a05400
Added .ConfigureAwait(false) to all of the await statements
2025-06-12 08:34:29 +02:00
Carl Johnsen
51f2d27166
Removed unused helper methods
2025-06-11 09:01:46 +02:00
Carl Johnsen
ebdddebeb1
Pragmas that change the safety level of a connection cannot be performed within a transaction
2025-06-11 09:01:12 +02:00
Carl Johnsen
51b86b06ff
Made the SQLiteLoader open async again
2025-06-11 09:00:26 +02:00
Carl Johnsen
115bf269d3
Pooling ensures that a connection (and thus also filehandle) may persist even after all of the database connections have been closed, which is undesirable.
2025-05-27 05:39:31 +02:00
Carl Johnsen
9a34ace37d
Microsoft.Data.Sqlite doesn't have OpenAsync(), only Open()
2025-05-23 15:49:10 +02:00
Carl Johnsen
41ebeee4f0
All transactions should be deferred
2025-05-23 11:18:03 +02:00
Carl Johnsen
3c6dc24390
Named the async functions in the SQLiteLoader explicitly, and added synchronous versions.
2025-05-16 12:21:56 +02:00
Carl Johnsen
d1b49238bd
Added TODOs
2025-05-16 11:49:57 +02:00
Carl Johnsen
e4d2ee275c
Small changes to use more modern C#
2025-05-16 11:49:57 +02:00
Carl Johnsen
1cfe154921
Made the SQLiteLoader async
2025-05-16 11:49:57 +02:00
Carl Johnsen
a5c783760f
Changed the SQLiteHelper.SQLiteLoader to use Microsoft.Data.SQLite as backend.
2025-05-16 11:49:57 +02:00
Carl Johnsen
a7bfe46ca8
Removed whitespace
2025-05-16 11:49:57 +02:00
Kenneth Skovhede
0a7a1cd689
Added option to set the SQLite page cache
...
This adds an extra option to allow setting the SQLite page cache size as a regular option.
Prior to this commit it was only possible to set the SQLite page cache size via environment variables.
The option to use environment variables is preserved, and as options from the environment variable are applied after the new setting, environment variables take precedence.
The default value for the new option is to use 1% of the system memory for the page cache. For the restore process, a connection per worker may be made which defaults to half the number of cores, so the maximum amount of memory is 1% * half the CPU cores.
This is just the upper limit, and SQLite may choose not to use all of it.
This fixes #6178
2025-04-22 14:26:46 +02:00
Kenneth Skovhede
0b735d79ff
More cleanup and a few bug fixes
2025-04-03 16:38:51 +02:00
Kenneth Skovhede
e2df06b8f5
Guards for setting permissions
...
When setting the permissions, this does not crash the process if it fails, but emits a warning.
2025-03-31 16:07:50 +02:00
Kenneth Skovhede
d8a15ac7ed
Fixed review comments
2025-03-20 12:05:16 +01:00
Kenneth Skovhede
fbe79b1ca3
Improve SQLite loading
...
This commit changes the way the new restore flow loads the extra database connections so these will also apply the temporary folder settings and custom pragmas.
This also changes the logic around the SQLite temporary folder. Previously, this folder would unconditionally be set to the general temporary folder, allowing only an override with a custom pragma.
No the setup checks if the system has the environment variable `SQLITE_TMPDIR` set already. If this variable is already set, it will NOT be overwritten.
Actual effects of this change depends on how SQLite internally resolves the temporary folder.
2025-03-20 10:05:10 +01:00
Kenneth Skovhede
fef0431144
Honor insecure permissions.
...
This commit changes the logic so permissions are only set on files, if the `insecure-permissions.txt` file is not found in the folder.
Prior to this commit, new files would be locked down without condition.
2025-03-19 21:20:07 +01:00
Kenneth Skovhede
f0f79418d8
Fixed logic so the permissions are always applied, unless the user specifically opts out by placing a file named insecure-permissions.txt in the data folder.
2025-02-06 17:09:18 +01:00
Kenneth Skovhede
aab91eb0df
Added protection to newly create data folder and databases
2025-02-06 16:56:06 +01:00
Kenneth Skovhede and GitHub
9464caf622
Feature/update license 2025 ( #5851 )
...
* Fixed some minor whitespace issues
* Updated all copyright to 2025
2025-01-07 09:40:39 +01:00
Kenneth Skovhede and GitHub
fdc891aa36
Merge pull request #5208 from Jojo-1000/fix-sql-quotes
...
Fix SQL string quotes
2024-06-04 20:58:20 +02:00
Jojo-1000
a5c6c18f26
Prevent SQLite crash on MacOS.
2024-06-04 19:35:06 +02:00
Jojo-1000
930f1c8bd3
Fix most unsupported platform warnings.
2024-05-30 01:50:02 +02:00
Jojo-1000
1dc1fd83af
Add SupportedOSPlatform attribute and target windows where appropriate.
2024-05-30 01:22:16 +02:00
Jojo-1000
2ecfde44f9
Disable double quoted sql string compatibility mode.
2024-05-30 00:00:49 +02:00
Kenneth Skovhede
1265f88cf8
Fixed disposing the read stream before moving the encrypted database.
...
Added more context to the default error message when decryption fails.
2024-05-08 12:48:10 +02:00
Kenneth Skovhede
612f657614
Added nullable to SQLiteLoader.
...
Avoid checking file if no password is supplied.
2024-04-24 11:16:11 +02:00
Kenneth Skovhede
9c0ef09a39
Implemented a built-in decrypt method.
...
Ported the RC4 algorithm from BouncyCastle.
This fixes #5147
2024-04-23 17:06:32 +02:00
Kenneth Skovhede
9377fdffc1
Unified the way the version is extracted from the SQLite library
2024-03-05 08:55:13 +01:00
Kenneth Skovhede
473c6cbbb8
Merge commit '4f577c65a4d8806f79637c50c21ca3a683c5a07a' into feature/kestrel-avalonia-upgrade
2024-03-04 12:21:53 +01:00
Kenneth Skovhede
d3d4fc1434
More cleanup after using Mono.Posix
2024-03-01 14:30:28 +01:00
Thomas Suckow
a3bbf63561
Merge remote-tracking branch 'origin/feature/upgrade-to-sdk-style-projects' into feature/net5-kestrel
...
# Conflicts:
# .appveyor.yml
# .github/workflows/tests.yml
# BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj
# BuildTools/DependencyFinder/DependencyFinder.csproj
# BuildTools/GnupgSigningTool/GnupgSigningTool.csproj
# BuildTools/UpdateVersionStamp/UpdateVersionStamp.csproj
# Duplicati CommandLine Only.sln
# Duplicati.Library.RestAPI/RESTMethods/RequestInfo.cs
# Duplicati.Library.RestAPI/Runner.cs
# Duplicati.sln
# Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj
# Duplicati/CommandLine/BackendTester/app.config
# Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj
# Duplicati/CommandLine/BackendTool/app.config
# Duplicati/CommandLine/ConfigurationImporter/Duplicati.CommandLine.ConfigurationImporter.csproj
# Duplicati/CommandLine/Duplicati.CommandLine.csproj
# Duplicati/CommandLine/RecoveryTool/Duplicati.CommandLine.RecoveryTool.csproj
# Duplicati/CommandLine/app.config
# Duplicati/GUI/Duplicati.GUI.TrayIcon/Assets/icons/normal-warning.png
# Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj
# Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs
# Duplicati/GUI/Duplicati.GUI.TrayIcon/app.config
# Duplicati/Library/AutoUpdater/Duplicati.Library.AutoUpdater.csproj
# Duplicati/Library/Backend/AlternativeFTP/Duplicati.Library.Backend.AlternativeFTP.csproj
# Duplicati/Library/Backend/AzureBlob/Duplicati.Library.Backend.AzureBlob.csproj
# Duplicati/Library/Backend/Backblaze/Duplicati.Library.Backend.Backblaze.csproj
# Duplicati/Library/Backend/Box/Duplicati.Library.Backend.Box.csproj
# Duplicati/Library/Backend/CloudFiles/Duplicati.Library.Backend.CloudFiles.csproj
# Duplicati/Library/Backend/Dropbox/Duplicati.Library.Backend.Dropbox.csproj
# Duplicati/Library/Backend/FTP/Duplicati.Library.Backend.FTP.csproj
# Duplicati/Library/Backend/File/Duplicati.Library.Backend.File.csproj
# Duplicati/Library/Backend/GoogleServices/Duplicati.Library.Backend.GoogleServices.csproj
# Duplicati/Library/Backend/HubiC/Duplicati.Library.Backend.HubiC.csproj
# Duplicati/Library/Backend/Idrivee2/Duplicati.Library.Backend.Idrivee2.csproj
# Duplicati/Library/Backend/Jottacloud/Duplicati.Library.Backend.Jottacloud.csproj
# Duplicati/Library/Backend/Mega/Duplicati.Library.Backend.Mega.csproj
# Duplicati/Library/Backend/OAuthHelper/Duplicati.Library.OAuthHelper.csproj
# Duplicati/Library/Backend/OneDrive/Duplicati.Library.Backend.OneDrive.csproj
# Duplicati/Library/Backend/OpenStack/Duplicati.Library.Backend.OpenStack.csproj
# Duplicati/Library/Backend/Rclone/Duplicati.Library.Backend.Rclone.csproj
# Duplicati/Library/Backend/S3/Duplicati.Library.Backend.S3.csproj
# Duplicati/Library/Backend/SSHv2/Duplicati.Library.Backend.SSHv2.csproj
# Duplicati/Library/Backend/SharePoint/Duplicati.Library.Backend.SharePoint.csproj
# Duplicati/Library/Backend/Sia/Duplicati.Library.Backend.Sia.csproj
# Duplicati/Library/Backend/Storj/Duplicati.Library.Backend.Storj.csproj
# Duplicati/Library/Backend/TahoeLAFS/Duplicati.Library.Backend.TahoeLAFS.csproj
# Duplicati/Library/Backend/Tardigrade/Duplicati.Library.Backend.Tardigrade.csproj
# Duplicati/Library/Backend/TencentCOS/Duplicati.Library.Backend.TencentCOS.csproj
# Duplicati/Library/Backend/WEBDAV/Duplicati.Library.Backend.WEBDAV.csproj
# Duplicati/Library/Common/Duplicati.Library.Common.csproj
# Duplicati/Library/Compression/Duplicati.Library.Compression.csproj
# Duplicati/Library/DynamicLoader/Duplicati.Library.DynamicLoader.csproj
# Duplicati/Library/Encryption/Duplicati.Library.Encryption.csproj
# Duplicati/Library/Interface/Duplicati.Library.Interface.csproj
# Duplicati/Library/Localization/Duplicati.Library.Localization.csproj
# Duplicati/Library/Logging/Duplicati.Library.Logging.csproj
# Duplicati/Library/Main/Duplicati.Library.Main.csproj
# Duplicati/Library/Modules/Builtin/CheckMonoSSL.cs
# Duplicati/Library/Modules/Builtin/Duplicati.Library.Modules.Builtin.csproj
# Duplicati/Library/Modules/Builtin/SendJabberMessage.cs
# Duplicati/Library/SQLiteHelper/Duplicati.Library.SQLiteHelper.csproj
# Duplicati/Library/Snapshots/Duplicati.Library.Snapshots.csproj
# Duplicati/Library/UsageReporter/Duplicati.Library.UsageReporter.csproj
# Duplicati/Library/Utility/Duplicati.Library.Utility.csproj
# Duplicati/Library/Utility/HashAlgorithmHelper.cs
# Duplicati/Library/Utility/Power/WindowsPowerSupplyState.cs
# Duplicati/License/Duplicati.License.csproj
# Duplicati/Server/Duplicati.Server.Serialization/Duplicati.Server.Serialization.csproj
# Duplicati/Server/Duplicati.Server.csproj
# Duplicati/Server/app.config
# Duplicati/Service/Duplicati.Service.csproj
# Duplicati/Service/app.config
# Duplicati/Tools/Duplicati.Tools.csproj
# Duplicati/UnitTest/Duplicati.UnitTest.csproj
# Duplicati/UnitTest/GeneralBlackBoxTesting.cs
# Duplicati/UnitTest/app.config
# Duplicati/WindowsService/WindowsService.csproj
# Installer/debian/docker/debian/control
# Tools/SQLiteTool/SQLiteTool.csproj
# Tools/ZipFileDebugger/ZipFileDebugger.csproj
# guiTests/guiTest.py
# thirdparty/UnixSupport/UnixSupport.csproj
# thirdparty/alphavss/Homepage.txt
# thirdparty/alphavss/License.txt
# thirdparty/alphavss/licensedata.json
2024-02-29 21:55:17 -08:00
Kenneth Skovhede
40dd3c6816
Updated all license mentions to MIT
2024-02-28 15:45:30 +01:00
gpatel-fr
fbbc78619e
add custom sqlite pragmas
...
through environment variable CUSTOMSQLITEOPTIONS_DUPLICATI
2023-03-23 20:25:18 +01:00
Thomas Suckow and Kenneth Hsu
060b4886da
Just use the nuget version of the sqlite library
...
This fixes #4526 .
2021-06-28 09:52:13 -07:00
Kenneth Hsu
0a91bcf662
Fix path to SQLite.Interop.dll.
...
This assembly lives in the win32 and win64 subdirectories, and not in
the base path.
This fixes #4093 .
2020-02-17 09:34:39 -08:00
verhoek
8bb406cd15
Migrated to use the platform class.
2018-11-02 22:17:16 +01:00
Kenneth Hsu
9e0b031fee
Remove unused members.
2018-10-15 21:20:30 -07:00
Kenneth Skovhede
8a00ce5c80
Merge branch 'verhoek-fix/sqlite_file_permissions'
...
# Conflicts:
# Duplicati/Library/SQLiteHelper/SQLiteLoader.cs
2018-06-28 10:50:17 +02:00
Kenneth Skovhede
db222c1991
Now getting the correct UID and GID
2018-06-28 09:28:14 +02:00
Kenneth Skovhede
5405139729
Replaced compile-time flag and dependency on Mono.Posix with a dynamic call to UnixSupport to defer loading the Mono.Posix library.
2018-06-27 13:36:08 +02:00
verhoek
fc5f582800
moved dll filename var to const. Only change permissions on new file creation.
2018-06-23 19:16:12 +02:00
verhoek
eabb840a4c
Only add mono.posix on non-windows.
2018-06-22 17:21:28 +02:00