|
|
|
@ -13,15 +13,17 @@ namespace NzbDrone.Update.Providers
|
|
|
|
|
private readonly ServiceProvider _serviceProvider;
|
|
|
|
|
private readonly ProcessProvider _processProvider;
|
|
|
|
|
private readonly EnviromentProvider _enviromentProvider;
|
|
|
|
|
private readonly IISProvider _iisProvider;
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
public UpdateProvider(DiskProvider diskProvider, ServiceProvider serviceProvider,
|
|
|
|
|
ProcessProvider processProvider, EnviromentProvider enviromentProvider)
|
|
|
|
|
ProcessProvider processProvider, EnviromentProvider enviromentProvider, IISProvider iisProvider)
|
|
|
|
|
{
|
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
_processProvider = processProvider;
|
|
|
|
|
_enviromentProvider = enviromentProvider;
|
|
|
|
|
_iisProvider = iisProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UpdateProvider()
|
|
|
|
@ -50,14 +52,14 @@ namespace NzbDrone.Update.Providers
|
|
|
|
|
bool isService = false;
|
|
|
|
|
|
|
|
|
|
logger.Info("Stopping all running services");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME)
|
|
|
|
|
&& _serviceProvider.IsServiceRunning(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
|
|
|
|
{
|
|
|
|
|
isService = true;
|
|
|
|
|
_serviceProvider.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.Info("Killing all running processes");
|
|
|
|
|
var processes = _processProvider.GetProcessByName(ProcessProvider.NzbDroneProccessName);
|
|
|
|
|
foreach (var processInfo in processes)
|
|
|
|
@ -65,6 +67,9 @@ namespace NzbDrone.Update.Providers
|
|
|
|
|
_processProvider.Kill(processInfo.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.Info("Killing all orphan IISExpress processes");
|
|
|
|
|
_iisProvider.StopServer();
|
|
|
|
|
|
|
|
|
|
logger.Info("Creating backup of existing installation");
|
|
|
|
|
_diskProvider.CopyDirectory(targetFolder, _enviromentProvider.GetUpdateBackUpFolder());
|
|
|
|
|
|
|
|
|
@ -79,7 +84,7 @@ namespace NzbDrone.Update.Providers
|
|
|
|
|
{
|
|
|
|
|
RollBack(targetFolder);
|
|
|
|
|
|
|
|
|
|
foreach(var key in e.Data.Keys)
|
|
|
|
|
foreach (var key in e.Data.Keys)
|
|
|
|
|
{
|
|
|
|
|
logger.Trace("Key: {0}, Value: {1}", key, e.Data[key]);
|
|
|
|
|
}
|
|
|
|
|