mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 10:44:23 -04:00
Merge pull request #374 from Bond-009/logs
DeleteLogFileTask: only delete the .txt log files
This commit is contained in:
commit
86275bcc55
@ -56,7 +56,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
// Delete log files more than n days old
|
// Delete log files more than n days old
|
||||||
var minDateModified = DateTime.UtcNow.AddDays(-ConfigurationManager.CommonConfiguration.LogFileRetentionDays);
|
var minDateModified = DateTime.UtcNow.AddDays(-ConfigurationManager.CommonConfiguration.LogFileRetentionDays);
|
||||||
|
|
||||||
var filesToDelete = _fileSystem.GetFiles(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, true)
|
// Only delete the .txt log files, the *.log files created by serilog get managed by itself
|
||||||
|
var filesToDelete = _fileSystem.GetFiles(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, new[] { ".txt" }, true, true)
|
||||||
.Where(f => _fileSystem.GetLastWriteTimeUtc(f) < minDateModified)
|
.Where(f => _fileSystem.GetLastWriteTimeUtc(f) < minDateModified)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@ -64,8 +65,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
foreach (var file in filesToDelete)
|
foreach (var file in filesToDelete)
|
||||||
{
|
{
|
||||||
double percent = index;
|
double percent = index / filesToDelete.Count;
|
||||||
percent /= filesToDelete.Count;
|
|
||||||
|
|
||||||
progress.Report(100 * percent);
|
progress.Report(100 * percent);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user