diff --git a/NzbDrone.Common/ConfigFileProvider.cs b/NzbDrone.Common/ConfigFileProvider.cs index e82df3874..5f7758a25 100644 --- a/NzbDrone.Common/ConfigFileProvider.cs +++ b/NzbDrone.Common/ConfigFileProvider.cs @@ -62,6 +62,12 @@ namespace NzbDrone.Common 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) { return Convert.ToInt32(GetValue(key, defaultValue)); diff --git a/NzbDrone.Web/App_Start/MiniProfiler.cs b/NzbDrone.Web/App_Start/MiniProfiler.cs index a0694dab8..f103e69c6 100644 --- a/NzbDrone.Web/App_Start/MiniProfiler.cs +++ b/NzbDrone.Web/App_Start/MiniProfiler.cs @@ -5,6 +5,7 @@ using MvcMiniProfiler; using MvcMiniProfiler.MVCHelpers; using Microsoft.Web.Infrastructure.DynamicModuleHelper; using NzbDrone.Common; +using NzbDrone.Web.Helpers; //using System.Data; //using System.Data.Entity; @@ -69,7 +70,7 @@ namespace NzbDrone.Web.App_Start // so authenticated users are always profiled //if (request.IsLocal) { MiniProfiler.Start(); } - if (!EnviromentProvider.IsProduction) + if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled()) { MiniProfiler.Start(); } diff --git a/NzbDrone.Web/Helpers/ProfilerHelper.cs b/NzbDrone.Web/Helpers/ProfilerHelper.cs new file mode 100644 index 000000000..641fd3916 --- /dev/null +++ b/NzbDrone.Web/Helpers/ProfilerHelper.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index bf83cad7d..e5013ac09 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -219,6 +219,7 @@ Global.asax + diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index 153ff82d2..3e4fbe756 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -13,7 +13,7 @@ ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title); } @ViewBag.Title - @if (!EnviromentProvider.IsProduction) + @if (!EnviromentProvider.IsProduction || ProfilerHelper.Enabled()) { @MvcMiniProfiler.MiniProfiler.RenderIncludes() }