Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus

Conflicts:
	NzbDrone.Web/NzbDrone.Web.csproj
This commit is contained in:
Mark McDowall 2011-11-13 22:12:03 -08:00
commit dff01f984e
5 changed files with 76 additions and 7 deletions

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Common
if (logEvent == null || logEvent.Exception == null) return;
if (Debugger.IsAttached || Process.GetCurrentProcess().ProcessName.Contains("JetBrains")) return;
Logger.Trace("Sending Exception to Exceptioneer. {0}", Process.GetCurrentProcess().ProcessName);
Logger.Trace("Sending Exception to Exceptioneer. Process Name: {0}", Process.GetCurrentProcess().ProcessName);
logEvent.Exception.Data.Add("Message", logEvent.Message);

View File

@ -2,6 +2,8 @@
using System.IO;
using System.Linq;
using NLog;
using NLog.Config;
using NLog.Targets;
using NzbDrone.Common;
using NzbDrone.Update.Providers;
@ -26,10 +28,7 @@ namespace NzbDrone.Update
{
Console.WriteLine("Starting NzbDrone Update Client");
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
LogConfiguration.RegisterUdpLogger();
LogConfiguration.RegisterExceptioneer();
LogConfiguration.Reload();
InitLoggers();
logger.Info("Initializing update application");
@ -48,6 +47,26 @@ namespace NzbDrone.Update
}
}
private static void InitLoggers()
{
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
LogConfiguration.RegisterUdpLogger();
LogConfiguration.RegisterExceptioneer();
var fileTarget = new FileTarget();
fileTarget.AutoFlush = true;
fileTarget.ConcurrentWrites = false;
fileTarget.DeleteOldFileOnStartup = true;
fileTarget.FileName = "upgrade.log";
fileTarget.KeepFileOpen =false;
fileTarget.Layout = "${logger}: ${message} ${exception}";
LogManager.Configuration.AddTarget(fileTarget.GetType().Name, fileTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogConfiguration.Reload();
}
public void Start(string[] args)
{
VerfityArguments(args);

View File

@ -0,0 +1,32 @@
using System.Linq;
using System.Web.Mvc;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Web.Models;
namespace NzbDrone.Web.Controllers
{
public class UpdateController : Controller
{
private readonly UpdateProvider _updateProvider;
private readonly JobProvider _jobProvider;
public UpdateController(UpdateProvider updateProvider, JobProvider jobProvider)
{
_updateProvider = updateProvider;
_jobProvider = jobProvider;
}
public ActionResult Index()
{
return View(_updateProvider.GetAvilableUpdate());
}
public ActionResult StartUpdate()
{
_jobProvider.QueueJob(typeof(AppUpdateJob), 0, 0);
return Json(new NotificationResult() { Title = "Update will begin shortly", NotificationType = NotificationType.Info, Text = "NzbDrone will restart automatically."});
}
}
}

View File

@ -50,6 +50,7 @@
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MvcMiniProfiler, Version=1.9.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MiniProfiler.1.9\lib\net40\MvcMiniProfiler.dll</HintPath>
@ -463,6 +464,7 @@
<Compile Include="Controllers\StreamController.cs" />
<Compile Include="Controllers\SystemController.cs" />
<Compile Include="Controllers\UpcomingController.cs" />
<Compile Include="Controllers\UpdateController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@ -939,7 +941,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\NewznabProvider.cshtml" />
</ItemGroup>
<Content Include="Views\Update\Index.cshtml" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@ -969,4 +971,4 @@ xcopy /s /y "$(SolutionDir)packages\SqlServerCompact.4.0.8482.1\NativeBinaries\x
if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64"
xcopy /s /y "$(SolutionDir)packages\SqlServerCompact.4.0.8482.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64"</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>

View File

@ -0,0 +1,16 @@
@model NzbDrone.Core.Model.UpdatePackage
@section TitleContent{
Update
}
@if (Model == null)
{
<h2>
There are no updates available.</h2>
}
else
{
<h2>
Available Update: @Model.Version
@Ajax.ActionLink("Update", "StartUpdate", "Update", null)
</h2>
}