diff options
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Common/IApplicationHost.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/SystemInfo.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/ApplicationHost.cs | 19 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/Native/NativeApp.cs | 12 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 4 |
9 files changed, 70 insertions, 10 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index e7a9c00c6..daa664a38 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -591,6 +591,12 @@ namespace MediaBrowser.Common.Implementations } /// <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> public void NotifyPendingRestart() diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 177df5afa..56b86a3c1 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -25,6 +25,12 @@ namespace MediaBrowser.Common 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> event EventHandler HasPendingRestartChanged; diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 60d0564d8..d736298b8 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -63,6 +63,12 @@ namespace MediaBrowser.Model.System 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> /// <value>The failed assembly loads.</value> diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 985a27d93..b74fd8a73 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -181,6 +181,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> /// <returns>Task.</returns> @@ -384,7 +393,7 @@ namespace MediaBrowser.ServerApplication await 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.ServerApplication ProgramDataPath = 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.cs index e69d46661..b4b2cf107 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.ServerApplication var logger = _logger = logManager.GetLogger("Main"); - BeginLog(logger); + BeginLog(logger, appPaths); // Install directly if (string.Equals(startFlag, "-installservice", StringComparison.OrdinalIgnoreCase)) @@ -163,16 +164,30 @@ 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 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.cs index ea4218afc..0e114b166 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.nuspec index b7fd2a38f..ff1ee204c 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.nuspec index f6b3aeef8..2a650c467 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.nuspec index b8227fa04..2d30823a3 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> |
