aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2019-01-14 18:28:29 +0100
committerBond_009 <bond.009@outlook.com>2019-01-23 18:34:34 +0100
commit8d9428ebdc463dcaa02cfa8daf91ab480f2ace6a (patch)
treecd8388ed7e3bef057793f5938227684628a1f3ed /Emby.Server.Implementations
parentf6f0a8a481332f55a4af68ee776580cb506dd48c (diff)
Ensure DB exists
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs5
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs16
2 files changed, 14 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index 34d6bc198..fb5f8d6ef 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -20,7 +20,10 @@ namespace Emby.Server.Implementations.Activity
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// Ensure the dir exists
- if (!Directory.Exists(_dataDirPath)) Directory.CreateDirectory(_dataDirPath);
+ if (!Directory.Exists(_dataDirPath))
+ {
+ Directory.CreateDirectory(_dataDirPath);
+ }
optionsBuilder.UseSqlite($"Filename={Path.Combine(_dataDirPath, "activitylog.sqlite.db")}");
}
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 6d0e251ce..3562074fe 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -709,7 +709,7 @@ namespace Emby.Server.Implementations
}
}
- public void Init()
+ public async Task Init()
{
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
@@ -739,7 +739,7 @@ namespace Emby.Server.Implementations
SetHttpLimit();
- RegisterResources();
+ await RegisterResources();
FindParts();
}
@@ -754,7 +754,7 @@ namespace Emby.Server.Implementations
/// <summary>
/// Registers resources that classes will depend on
/// </summary>
- protected void RegisterResources()
+ protected async Task RegisterResources()
{
RegisterSingleInstance(ConfigurationManager);
RegisterSingleInstance<IApplicationHost>(this);
@@ -931,7 +931,7 @@ namespace Emby.Server.Implementations
EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager);
RegisterSingleInstance(EncodingManager);
- var activityLogRepo = GetActivityLogRepository();
+ var activityLogRepo = await GetActivityLogRepository();
RegisterSingleInstance(activityLogRepo);
RegisterSingleInstance<IActivityManager>(new ActivityManager(LoggerFactory, activityLogRepo, UserManager));
@@ -1146,9 +1146,13 @@ namespace Emby.Server.Implementations
return repo;
}
- private IActivityRepository GetActivityLogRepository()
+ private async Task<IActivityRepository> GetActivityLogRepository()
{
- return new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath);
+ var repo = new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath);
+
+ await repo.Database.EnsureCreatedAsync();
+
+ return repo;
}
/// <summary>