The Free Software Media System - Server Backend & API
added CanSelfRestart
Luke Pulverenti65f78ea5ad19
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.csindex e7a9c00c61..daa664a388 100644--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs@@ -590,6 +590,12 @@ namespace MediaBrowser.Common.ImplementationsPlugins = list;}+ /// <summary>+ /// Gets a value indicating whether this instance can self restart.+ /// </summary>+ /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>+ public abstract bool CanSelfRestart { get; }+/// <summary>/// Notifies that the kernel that a change has been made that requires a restart/// </summary>diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.csindex 177df5afaa..56b86a3c11 100644--- a/MediaBrowser.Common/IApplicationHost.cs+++ b/MediaBrowser.Common/IApplicationHost.cs@@ -24,6 +24,12 @@ namespace MediaBrowser.Common/// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>bool HasPendingRestart { get; }+ /// <summary>+ /// Gets a value indicating whether this instance can self restart.+ /// </summary>+ /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>+ bool CanSelfRestart { get; }+/// <summary>/// Occurs when [has pending restart changed]./// </summary>diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.csindex 60d0564d83..d736298b8f 100644--- a/MediaBrowser.Model/System/SystemInfo.cs+++ b/MediaBrowser.Model/System/SystemInfo.cs@@ -62,6 +62,12 @@ namespace MediaBrowser.Model.System/// <value><c>true</c> if [supports native web socket]; otherwise, <c>false</c>.</value>public bool SupportsNativeWebSocket { get; set; }+ /// <summary>+ /// Gets or sets a value indicating whether this instance can self restart.+ /// </summary>+ /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>+ public bool CanSelfRestart { get; set; }+/// <summary>/// Gets or sets plugin assemblies that failed to load./// </summary>diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.csindex 985a27d93c..b74fd8a739 100644--- a/MediaBrowser.ServerApplication/ApplicationHost.cs+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs@@ -180,6 +180,15 @@ namespace MediaBrowser.ServerApplication}+ /// <summary>+ /// Gets a value indicating whether this instance can self restart.+ /// </summary>+ /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>+ public override bool CanSelfRestart+ {+ get { return NativeApp.CanSelfRestart; }+ }+/// <summary>/// Runs the startup tasks./// </summary>@@ -384,7 +393,7 @@ namespace MediaBrowser.ServerApplicationawait repo.Initialize().ConfigureAwait(false);- ((UserDataManager) UserDataManager).Repository = repo;+ ((UserDataManager)UserDataManager).Repository = repo;}/// <summary>@@ -493,6 +502,11 @@ namespace MediaBrowser.ServerApplication/// </summary>public override async Task Restart(){+ if (!CanSelfRestart)+ {+ throw new InvalidOperationException("The server is unable to self-restart. Please restart manually.");+ }+try{await SessionManager.SendServerRestartNotification(CancellationToken.None).ConfigureAwait(false);@@ -588,7 +602,8 @@ namespace MediaBrowser.ServerApplicationProgramDataPath = ApplicationPaths.ProgramDataPath,MacAddress = GetMacAddress(),HttpServerPortNumber = ServerConfigurationManager.Configuration.HttpServerPortNumber,- OperatingSystem = Environment.OSVersion.ToString()+ OperatingSystem = Environment.OSVersion.ToString(),+ CanSelfRestart = CanSelfRestart};}diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.csindex e69d466613..b4b2cf1071 100644--- a/MediaBrowser.ServerApplication/MainStartup.cs+++ b/MediaBrowser.ServerApplication/MainStartup.cs@@ -1,4 +1,5 @@-using MediaBrowser.Common.Constants;+using MediaBrowser.Common.Configuration;+using MediaBrowser.Common.Constants;using MediaBrowser.Common.Implementations.Logging;using MediaBrowser.Common.Implementations.Updates;using MediaBrowser.Controller.IO;@@ -44,7 +45,7 @@ namespace MediaBrowser.ServerApplicationvar logger = _logger = logManager.GetLogger("Main");- BeginLog(logger);+ BeginLog(logger, appPaths);// Install directlyif (string.Equals(startFlag, "-installservice", StringComparison.OrdinalIgnoreCase))@@ -162,17 +163,31 @@ namespace MediaBrowser.ServerApplicationreturn new ServerApplicationPaths();}+ /// <summary>+ /// Gets a value indicating whether this instance can self restart.+ /// </summary>+ /// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>+ public static bool CanSelfRestart+ {+ get+ {+ return true;+ }+ }+/// <summary>/// Begins the log./// </summary>/// <param name="logger">The logger.</param>- private static void BeginLog(ILogger logger)+ /// <param name="appPaths">The app paths.</param>+ private static void BeginLog(ILogger logger, IApplicationPaths appPaths){logger.Info("Media Browser Server started");logger.Info("Command line: {0}", string.Join(" ", Environment.GetCommandLineArgs()));logger.Info("Server: {0}", Environment.MachineName);logger.Info("Operating system: {0}", Environment.OSVersion.ToString());+ logger.Info("Program data path: {0}", appPaths.ProgramDataPath);}/// <summary>diff --git a/MediaBrowser.ServerApplication/Native/NativeApp.cs b/MediaBrowser.ServerApplication/Native/NativeApp.csindex ea4218afc9..0e114b166d 100644--- a/MediaBrowser.ServerApplication/Native/NativeApp.cs+++ b/MediaBrowser.ServerApplication/Native/NativeApp.cs@@ -21,5 +21,17 @@ namespace MediaBrowser.ServerApplication.Native{MainStartup.Restart();}++ /// <summary>+ /// Determines whether this instance [can self restart].+ /// </summary>+ /// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>+ public static bool CanSelfRestart+ {+ get+ {+ return MainStartup.CanSelfRestart;+ }+ }}}diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex b7fd2a38f0..ff1ee204c2 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.222</version>+ <version>3.0.223</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.222" />+ <dependency id="MediaBrowser.Common" version="3.0.223" /><dependency id="NLog" version="2.0.1.2" /><dependency id="ServiceStack.Text" version="3.9.58" /><dependency id="SimpleInjector" version="2.3.2" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex f6b3aeef85..2a650c467e 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.222</version>+ <version>3.0.223</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex b8227fa043..2d30823a30 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.222</version>+ <version>3.0.223</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.222" />+ <dependency id="MediaBrowser.Common" version="3.0.223" /></dependencies></metadata><files>