mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
added CanSelfRestart
This commit is contained in:
parent
3f1cafdc81
commit
65f78ea5ad
@ -590,6 +590,12 @@ namespace MediaBrowser.Common.Implementations
|
||||
Plugins = 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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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.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
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
@ -162,17 +163,31 @@ namespace MediaBrowser.ServerApplication
|
||||
return 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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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" />
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user