mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
fixes #180 - Deleting users doesn't remove all associated data.
This commit is contained in:
parent
fa53ad940f
commit
4c69edebe0
|
@ -312,7 +312,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Gets the path to the user's configuration file
|
/// Gets the path to the user's configuration file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configuration file path.</value>
|
/// <value>The configuration file path.</value>
|
||||||
private string ConfigurationFilePath
|
public string ConfigurationFilePath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.Events;
|
using System.IO;
|
||||||
|
using MediaBrowser.Common.Events;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
|
@ -485,6 +486,31 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
await UserRepository.DeleteUser(user, CancellationToken.None).ConfigureAwait(false);
|
await UserRepository.DeleteUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (user.Configuration.UseCustomLibrary)
|
||||||
|
{
|
||||||
|
var path = user.RootFolderPath;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(path, true);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error deleting directory {0}", ex, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
path = user.ConfigurationFilePath;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(path);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error deleting file {0}", ex, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnUserDeleted(user);
|
OnUserDeleted(user);
|
||||||
|
|
||||||
// Force this to be lazy loaded again
|
// Force this to be lazy loaded again
|
||||||
|
|
Loading…
Reference in a new issue