Profiler can be enabled via config file.

pull/7/merge
Mark McDowall 13 years ago
parent f56bf62991
commit 28259bc254

@ -62,6 +62,12 @@ namespace NzbDrone.Common
set { SetValue("AuthenticationType", (int)value); } set { SetValue("AuthenticationType", (int)value); }
} }
public virtual bool EnableProfiler
{
get { return GetValueBoolean("EnableProfiler", false); }
set { SetValue("EnableProfiler", value); }
}
public virtual int GetValueInt(string key, int defaultValue) public virtual int GetValueInt(string key, int defaultValue)
{ {
return Convert.ToInt32(GetValue(key, defaultValue)); return Convert.ToInt32(GetValue(key, defaultValue));

@ -5,6 +5,7 @@ using MvcMiniProfiler;
using MvcMiniProfiler.MVCHelpers; using MvcMiniProfiler.MVCHelpers;
using Microsoft.Web.Infrastructure.DynamicModuleHelper; using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Web.Helpers;
//using System.Data; //using System.Data;
//using System.Data.Entity; //using System.Data.Entity;
@ -69,7 +70,7 @@ namespace NzbDrone.Web.App_Start
// so authenticated users are always profiled // so authenticated users are always profiled
//if (request.IsLocal) { MiniProfiler.Start(); } //if (request.IsLocal) { MiniProfiler.Start(); }
if (!EnviromentProvider.IsProduction) if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled())
{ {
MiniProfiler.Start(); MiniProfiler.Start();
} }

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NzbDrone.Common;
namespace NzbDrone.Web.Helpers
{
public static class ProfilerHelper
{
public static bool Enabled()
{
var enviromentProvider = new EnviromentProvider();
var configFileProvider = new ConfigFileProvider(enviromentProvider);
return configFileProvider.EnableProfiler;
}
}
}

@ -219,6 +219,7 @@
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
</Compile> </Compile>
<Compile Include="Helpers\HtmlIncludeExtentions.cs" /> <Compile Include="Helpers\HtmlIncludeExtentions.cs" />
<Compile Include="Helpers\ProfilerHelper.cs" />
<Compile Include="Helpers\ValueExtension.cs" /> <Compile Include="Helpers\ValueExtension.cs" />
<Compile Include="Helpers\DescriptionExtension.cs" /> <Compile Include="Helpers\DescriptionExtension.cs" />
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" /> <Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />

@ -13,7 +13,7 @@
ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title); ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title);
} }
<title>@ViewBag.Title</title> <title>@ViewBag.Title</title>
@if (!EnviromentProvider.IsProduction) @if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled())
{ {
@MvcMiniProfiler.MiniProfiler.RenderIncludes() @MvcMiniProfiler.MiniProfiler.RenderIncludes()
} }

Loading…
Cancel
Save