mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
Don't ignore original wal/journal during v3 migration
Fixes #6067 Doesn't really apply to us, save for realllly old installs. Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Security.AccessControl;
|
|
||||||
using System.Security.Principal;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Exceptions;
|
using NzbDrone.Common.Exceptions;
|
||||||
@@ -91,8 +88,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_diskProvider.MoveFile(oldDbFile, _appFolderInfo.GetDatabase());
|
MoveSqliteDatabase(oldDbFile, _appFolderInfo.GetDatabase());
|
||||||
CleanupSqLiteRollbackFiles();
|
|
||||||
RemovePidFile();
|
RemovePidFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,12 +101,9 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
// Rename the DB file
|
// Rename the DB file
|
||||||
if (_diskProvider.FileExists(oldDbFile))
|
if (_diskProvider.FileExists(oldDbFile))
|
||||||
{
|
{
|
||||||
_diskProvider.MoveFile(oldDbFile, _appFolderInfo.GetDatabase());
|
MoveSqliteDatabase(oldDbFile, _appFolderInfo.GetDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove SQLite rollback files
|
|
||||||
CleanupSqLiteRollbackFiles();
|
|
||||||
|
|
||||||
// Remove Old PID file
|
// Remove Old PID file
|
||||||
RemovePidFile();
|
RemovePidFile();
|
||||||
}
|
}
|
||||||
@@ -159,12 +152,37 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanupSqLiteRollbackFiles()
|
private void MoveSqliteDatabase(string source, string destination)
|
||||||
{
|
{
|
||||||
_diskProvider.GetFiles(_appFolderInfo.AppDataFolder, SearchOption.TopDirectoryOnly)
|
_logger.Info("Moving {0}* to {1}*", source, destination);
|
||||||
.Where(f => Path.GetFileName(f).StartsWith("nzbdrone.db"))
|
|
||||||
.ToList()
|
var dbSuffixes = new[] { "", "-shm", "-wal", "-journal" };
|
||||||
.ForEach(_diskProvider.DeleteFile);
|
|
||||||
|
foreach (var suffix in dbSuffixes)
|
||||||
|
{
|
||||||
|
var sourceFile = source + suffix;
|
||||||
|
var destFile = destination + suffix;
|
||||||
|
|
||||||
|
if (_diskProvider.FileExists(destFile))
|
||||||
|
{
|
||||||
|
_diskProvider.DeleteFile(destFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_diskProvider.FileExists(sourceFile))
|
||||||
|
{
|
||||||
|
_diskProvider.CopyFile(sourceFile, destFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var suffix in dbSuffixes)
|
||||||
|
{
|
||||||
|
var sourceFile = source + suffix;
|
||||||
|
|
||||||
|
if (_diskProvider.FileExists(sourceFile))
|
||||||
|
{
|
||||||
|
_diskProvider.DeleteFile(sourceFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemovePidFile()
|
private void RemovePidFile()
|
||||||
|
|||||||
Reference in New Issue
Block a user