1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-27 10:18:55 +00:00

core: fix indexer configuration renaming. resolves #8903 (#8907)

This commit is contained in:
Diego Heras 2020-06-07 17:51:49 +02:00 committed by GitHub
parent 03cc3f4f60
commit b570b1d1f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,10 +76,20 @@ namespace Jackett.Common.Services
if (File.Exists(oldPath))
{
// if the old configuration exists, we rename it to be used by the renamed indexer
logger.Info($"Old configuration detected: {oldPath}");
var newPath = configService.GetIndexerConfigFilePath(renamedIndexers[oldId]);
if (File.Exists(newPath))
File.Delete(newPath);
File.Move(oldPath, newPath);
if (File.Exists(oldPath + ".bak"))
File.Move(oldPath + ".bak", newPath + ".bak");
// backups
var oldPathBak = oldPath + ".bak";
var newPathBak = newPath + ".bak";
if (File.Exists(oldPathBak))
{
if (File.Exists(newPathBak))
File.Delete(newPathBak);
File.Move(oldPathBak, newPathBak);
}
logger.Info($"Configuration renamed: {oldPath} => {newPath}");
}
}