diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index cc60183f8..070c5239e 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities.Audio; namespace MediaBrowser.Server.Implementations.Persistence @@ -25,8 +24,6 @@ namespace MediaBrowser.Server.Implementations.Persistence private readonly IServerConfigurationManager _config; private readonly IFileSystem _fileSystem; - public const int MigrationVersion = 4; - public CleanDatabaseScheduledTask(ILibraryManager libraryManager, IItemRepository itemRepo, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem) { _libraryManager = libraryManager; @@ -67,8 +64,6 @@ namespace MediaBrowser.Server.Implementations.Persistence innerProgress.RegisterAction(p => progress.Report(45 + (.55 * p))); await CleanDeletedItems(cancellationToken, innerProgress).ConfigureAwait(false); progress.Report(100); - - await _itemRepo.UpdateInheritedValues(cancellationToken).ConfigureAwait(false); } private async Task UpdateToLatestSchema(CancellationToken cancellationToken, IProgress progress) @@ -120,9 +115,9 @@ namespace MediaBrowser.Server.Implementations.Persistence progress.Report(percent * 100); } - if (_config.Configuration.MigrationVersion < MigrationVersion) + if (!_config.Configuration.DisableStartupScan) { - _config.Configuration.MigrationVersion = MigrationVersion; + _config.Configuration.DisableStartupScan = true; _config.SaveConfiguration(); } @@ -149,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Persistence if (item != null) { - _logger.Debug("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty); + _logger.Info("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty); await _libraryManager.DeleteItem(item, new DeleteOptions { @@ -175,18 +170,7 @@ namespace MediaBrowser.Server.Implementations.Persistence //Limit = limit, // These have their own cleanup routines - ExcludeItemTypes = new[] - { - typeof(Person).Name, - typeof(Genre).Name, - typeof(MusicGenre).Name, - typeof(GameGenre).Name, - typeof(Studio).Name, - typeof(Year).Name, - typeof(Channel).Name, - typeof(AggregateFolder).Name, - typeof(CollectionFolder).Name - } + ExcludeItemTypes = new[] { typeof(Person).Name, typeof(Genre).Name, typeof(MusicGenre).Name, typeof(GameGenre).Name, typeof(Studio).Name, typeof(Year).Name } }); var numComplete = 0; @@ -214,6 +198,8 @@ namespace MediaBrowser.Server.Implementations.Persistence continue; } + _logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItem.Path ?? string.Empty); + await _libraryManager.DeleteItem(libraryItem, new DeleteOptions { DeleteFileLocation = false