diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/ContainerModule.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/ContainerModule.cs
deleted file mode 100644
index bb93e0752..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/ContainerModule.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the ContainerModule type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler
-{
- using System;
-
- using Autofac;
-
- using Four2n.Orchard.MiniProfiler.Data;
-
- using global::Orchard.Environment;
-
- using StackExchange.Profiling;
- using StackExchange.Profiling.Storage;
-
- using Module = Autofac.Module;
-
- public class ContainerModule : Module
- {
- private readonly IOrchardHost orchardHost;
-
- public ContainerModule(IOrchardHost orchardHost)
- {
- this.orchardHost = orchardHost;
- }
-
- protected override void Load(ContainerBuilder moduleBuilder)
- {
- InitProfilerSettings();
- var currentLogger = ((DefaultOrchardHost)this.orchardHost).Logger;
- if (currentLogger is OrchardHostProxyLogger)
- {
- return;
- }
-
- ((DefaultOrchardHost)this.orchardHost).Logger = new OrchardHostProxyLogger(currentLogger);
- }
-
- private static void InitProfilerSettings()
- {
- MiniProfiler.Settings.SqlFormatter = new PoorMansTSqlFormatter();
- MiniProfiler.Settings.Storage = new ProfilerStorage(TimeSpan.FromSeconds(30));
- MiniProfiler.Settings.StackMaxLength = 500;
- MiniProfiler.Settings.ExcludeAssembly("MiniProfiler");
- MiniProfiler.Settings.ExcludeAssembly("NHibernate");
- WebRequestProfilerProvider.Settings.UserProvider = new IpAddressIdentity();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/PoorMansTSqlFormatter.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/PoorMansTSqlFormatter.cs
deleted file mode 100644
index c86d64ea8..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/PoorMansTSqlFormatter.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the PoorMansTSqlFormatter type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Data
-{
- using PoorMansTSqlFormatterLib;
- using PoorMansTSqlFormatterLib.Formatters;
-
- using StackExchange.Profiling;
- using StackExchange.Profiling.SqlFormatters;
-
- public class PoorMansTSqlFormatter : ISqlFormatter
- {
-
- public string FormatSql(SqlTiming timing)
- {
- var sqlFormatter = new SqlServerFormatter();
- var sqlFormat = sqlFormatter.FormatSql(timing);
-
- var poorMansFormatter = new TSqlStandardFormatter();
- var fullFormatter = new SqlFormattingManager(poorMansFormatter);
- return fullFormatter.Format(sqlFormat);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlCeDataServicesProvider.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlCeDataServicesProvider.cs
deleted file mode 100644
index 525ca2b84..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlCeDataServicesProvider.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the ProfiledSqlCeDataServicesProvider type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-using FluentNHibernate.Cfg.Db;
-using MsSqlCeConfiguration = Orchard.Data.Providers.MsSqlCeConfiguration;
-
-namespace Four2n.Orchard.MiniProfiler.Data.Providers
-{
- using global::Orchard.Environment.Extensions;
-
- [OrchardSuppressDependency("Orchard.Data.Providers.SqlCeDataServicesProvider")]
- public class ProfiledSqlCeDataServicesProvider : global::Orchard.Data.Providers.SqlCeDataServicesProvider
- {
- public ProfiledSqlCeDataServicesProvider(string dataFolder, string connectionString)
- : base(dataFolder, connectionString)
- {
- }
-
- public new static string ProviderName
- {
- get { return global::Orchard.Data.Providers.SqlCeDataServicesProvider.ProviderName; }
- }
-
- public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase)
- {
- var persistence = (MsSqlCeConfiguration)base.GetPersistenceConfigurer(createDatabase);
- return persistence.Driver(typeof(ProfiledSqlServerCeDriver).AssemblyQualifiedName);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlClientDriver.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlClientDriver.cs
deleted file mode 100644
index f0b193305..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlClientDriver.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the ProfiledSqlClientDriver type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Data.Providers
-{
- using System.Data;
- using System.Data.Common;
- using System.Diagnostics;
-
- using NHibernate.Driver;
-
- using StackExchange.Profiling.Data;
-
- public class ProfiledSqlClientDriver : SqlClientDriver
- {
- public override IDbCommand CreateCommand()
- {
- var command = base.CreateCommand();
- if (StackExchange.Profiling.MiniProfiler.Current != null)
- {
- command = new ProfiledDbCommand(
- (DbCommand)command,
- (ProfiledDbConnection)command.Connection,
- StackExchange.Profiling.MiniProfiler.Current);
- }
-
- return command;
- }
-
- public override IDbConnection CreateConnection()
- {
- if (StackExchange.Profiling.MiniProfiler.Current == null)
- {
- return base.CreateConnection();
- }
-
- return new ProfiledDbConnection(
- base.CreateConnection() as DbConnection,
- StackExchange.Profiling.MiniProfiler.Current);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerCeDriver.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerCeDriver.cs
deleted file mode 100644
index b01a9f74d..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerCeDriver.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the ProfiledSqlServerCeDriver type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Data.Providers
-{
- using System.Data;
- using System.Data.Common;
- using System.Diagnostics;
-
- using global::Orchard.Data.Providers;
-
- using StackExchange.Profiling.Data;
-
- public class ProfiledSqlServerCeDriver : SqlCeDataServicesProvider.OrchardSqlServerCeDriver
- {
- public override IDbCommand CreateCommand()
- {
- var command = base.CreateCommand();
- if (StackExchange.Profiling.MiniProfiler.Current != null)
- {
- command = new ProfiledDbCommand(
- (DbCommand)command,
- (ProfiledDbConnection)command.Connection,
- StackExchange.Profiling.MiniProfiler.Current);
- }
-
- return command;
- }
-
- public override IDbConnection CreateConnection()
- {
- if (StackExchange.Profiling.MiniProfiler.Current == null)
- {
- return base.CreateConnection();
- }
-
- return new ProfiledDbConnection(
- base.CreateConnection() as DbConnection,
- StackExchange.Profiling.MiniProfiler.Current);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerDataServicesProvider.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerDataServicesProvider.cs
deleted file mode 100644
index 02d4f1383..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Data/Providers/ProfiledSqlServerDataServicesProvider.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the ProfiledSqlServerDataServicesProvider type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Data.Providers
-{
- using System.Diagnostics;
-
- using FluentNHibernate.Cfg.Db;
-
- using global::Orchard.Environment.Extensions;
-
- [OrchardSuppressDependency("Orchard.Data.Providers.SqlServerDataServicesProvider")]
- public class ProfiledSqlServerDataServicesProvider : global::Orchard.Data.Providers.SqlServerDataServicesProvider
- {
- public ProfiledSqlServerDataServicesProvider(string dataFolder, string connectionString)
- : base(dataFolder, connectionString)
- {
- }
-
- public new static string ProviderName
- {
- get { return global::Orchard.Data.Providers.SqlServerDataServicesProvider.ProviderName; }
- }
-
- public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase)
- {
- var persistence = (MsSqlConfiguration)base.GetPersistenceConfigurer(createDatabase);
- Debug.WriteLine("[Four2n.MiniProfiler] - ProfiledSqlServerDataServicesProvider - GetPersistenceConfigurer ");
- return persistence.Driver(typeof(ProfiledSqlClientDriver).AssemblyQualifiedName);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Eventer.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Eventer.cs
deleted file mode 100644
index 834baa48f..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Eventer.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-namespace Four2n.Orchard.MiniProfiler
-{
- using System.Diagnostics;
-
- using global::Orchard.Environment;
- using global::Orchard.Environment.Extensions.Models;
- using global::Orchard.Environment.State;
-
- public class Eventer : IFeatureEventHandler, IShellStateManagerEventHandler
- {
- public void Installing(Feature feature)
- {
- Debug.WriteLine("Installing");
- }
-
- public void Installed(Feature feature)
- {
- Debug.WriteLine("Installed");
- }
-
- public void Enabling(Feature feature)
- {
- Debug.WriteLine("Enabling");
- }
-
- public void Enabled(Feature feature)
- {
- Debug.WriteLine("Enabled");
- }
-
- public void Disabling(Feature feature)
- {
- Debug.WriteLine("Disabling");
- }
-
- public void Disabled(Feature feature)
- {
- Debug.WriteLine("Disabled");
- }
-
- public void Uninstalling(Feature feature)
- {
- Debug.WriteLine("Uninstalling");
- }
-
- public void Uninstalled(Feature feature)
- {
- Debug.WriteLine("uninstalled");
- }
-
- public void ApplyChanges()
- {
- Debug.WriteLine("ApplyChanges");
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Filters/ProfilerFilter.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Filters/ProfilerFilter.cs
deleted file mode 100644
index f8de2cab6..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Filters/ProfilerFilter.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Filter for injecting profiler view code.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Filters
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Routing;
-
- using global::Orchard;
- using global::Orchard.DisplayManagement;
- using global::Orchard.Mvc.Filters;
- using global::Orchard.Security;
- using global::Orchard.UI.Admin;
- using Four2n.Orchard.MiniProfiler.Services;
-
- using StackExchange.Profiling;
-
- ///
- /// Filter for injecting profiler view code.
- ///
- public class ProfilerFilter : FilterProvider, IResultFilter, IActionFilter
- {
- #region Constants and Fields
-
- private readonly IAuthorizer authorizer;
- private readonly dynamic shapeFactory;
-
- private readonly WorkContext workContext;
-
- private readonly IProfilerService profiler;
-
- #endregion
-
- #region Constructors and Destructors
-
- public ProfilerFilter(WorkContext workContext, IAuthorizer authorizer, IShapeFactory shapeFactory, IProfilerService profiler)
- {
- this.workContext = workContext;
- this.shapeFactory = shapeFactory;
- this.authorizer = authorizer;
- this.profiler = profiler;
- }
-
- #endregion
-
- #region Public Methods
-
- public void OnActionExecuted(ActionExecutedContext filterContext)
- {
- this.profiler.StepStop(StepKeys.ActionFilter);
- }
-
- public void OnActionExecuting(ActionExecutingContext filterContext)
- {
- var tokens = filterContext.RouteData.DataTokens;
- string area = tokens.ContainsKey("area") && !string.IsNullOrEmpty(tokens["area"].ToString()) ?
- string.Concat(tokens["area"], ".") :
- string.Empty;
- string controller = string.Concat(filterContext.Controller.ToString().Split('.').Last(), ".");
- string action = filterContext.ActionDescriptor.ActionName;
- this.profiler.StepStart(StepKeys.ActionFilter, "Controller: " + area + controller + action);
- }
-
- public void OnResultExecuted(ResultExecutedContext filterContext)
- {
- // should only run on a full view rendering result
- if (!(filterContext.Result is ViewResult))
- {
- return;
- }
-
- if (!this.IsActivable())
- {
- return;
- }
-
- this.profiler.StepStop(StepKeys.ResultFilter);
- }
-
- public void OnResultExecuting(ResultExecutingContext filterContext)
- {
- // should only run on a full view rendering result
- if (!(filterContext.Result is ViewResult))
- {
- return;
- }
-
- if (!this.IsActivable())
- {
- return;
- }
-
- var place = this.workContext.Layout.Footer ?? this.workContext.Layout.Head;
- place.Add(this.shapeFactory.MiniProfilerTemplate());
-
- this.profiler.StepStart(StepKeys.ResultFilter, string.Format("Result: {0}", filterContext.Result));
- }
-
- #endregion
-
- #region Methods
-
- private bool IsActivable()
- {
- // activate on front-end only
- if (AdminFilter.IsApplied(new RequestContext(this.workContext.HttpContext, new RouteData())))
- {
- return false;
- }
-
- // if not logged as a site owner, still activate if it's a local request (development machine)
- if (!this.authorizer.Authorize(StandardPermissions.SiteOwner))
- {
- return this.workContext.HttpContext.Request.IsLocal;
- }
-
- return true;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Four2n.MiniProfiler.csproj b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Four2n.MiniProfiler.csproj
deleted file mode 100644
index 7574dd4fb..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Four2n.MiniProfiler.csproj
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {CAE8555E-F636-4C97-97A7-A041D3490D28}
- {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Four2n.Orchard.MiniProfiler
- Four2n.MiniProfiler
- v4.0
- false
-
-
- 4.0
-
-
-
- false
-
-
- true
- full
- false
- bin\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
-
-
- pdbonly
- true
- bin\
- TRACE
- prompt
- 4
- AllRules.ruleset
-
-
-
- False
- ..\..\..\..\lib\autofac\Autofac.dll
-
-
- False
- ..\..\..\..\lib\claysharp\ClaySharp.dll
-
-
- False
- ..\..\..\..\lib\nhibernate\FluentNHibernate.dll
-
-
-
- lib\MiniProfiler.dll
-
-
- ..\..\..\..\lib\nhibernate\NHibernate.dll
-
-
- lib\PoorMansTSqlFormatterLib.dll
-
-
-
-
- 3.5
-
-
-
- False
- ..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll
-
-
-
-
-
-
-
-
-
-
- Designer
-
-
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}
- Orchard.Framework
-
-
- {9916839C-39FC-4CEB-A5AF-89CA7E87119F}
- Orchard.Core
-
-
-
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
-
-
-
-
- $(ProjectDir)\..\Manifests
-
-
-
-
-
-
-
-
-
-
-
- False
- True
- 45979
- /
-
-
- False
- True
- http://orchard.codeplex.com
- False
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Models/DummyRecord.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Models/DummyRecord.cs
deleted file mode 100644
index eba422006..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Models/DummyRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the DummyRecord type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler.Models
-{
- using global::Orchard.ContentManagement.Records;
-
- ///
- /// Dummy record for including this module in data configuring.
- ///
- //public class DummyRecord : ContentPartRecord
- //{
- //}
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Module.txt b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Module.txt
deleted file mode 100644
index 565d81021..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Module.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Name: Mini Profiler
-AntiForgery: enabled
-Author: 42n, Daniel Dabrowski
-Website: http://orchardprofiler.codeplex.com/
-Version: 0.4
-OrchardVersion: 1.4
-Description: Module which delivers profiler functionality.
- Mvc Mini profiler (http://code.google.com/p/mvc-mini-profiler/) is used for collecting profile data.
- Poor Man's T-SQL Formatter (http://www.architectshack.com/PoorMansTSqlFormatter.ashx) is used for nicer SQL timing format. Source code is hosted on GitHub (https://github.com/TaoK/PoorMansTSqlFormatter)
-
-FeatureDescription: Profiling web site using mvc mini profiler.
-Category: Developer
-Tags: Profiler, Profiling, mvc-mini-profiler
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/OrchardHostProxyLogger.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/OrchardHostProxyLogger.cs
deleted file mode 100644
index b02ea0674..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/OrchardHostProxyLogger.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
-//
-//
-// Defines the OrchardHostProxyLogger type.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace Four2n.Orchard.MiniProfiler
-{
- using System;
-
- using global::Orchard.Logging;
-
- using StackExchange.Profiling;
-
- public class OrchardHostProxyLogger : ILogger
- {
- private readonly ILogger logger;
-
- public OrchardHostProxyLogger(ILogger logger)
- {
- this.logger = logger;
- }
-
- public bool IsEnabled(LogLevel level)
- {
- return true;
- }
-
- public void Log(LogLevel level, Exception exception, string format, params object[] args)
- {
- if (level == LogLevel.Debug)
- {
- if ("BeginRequest".Equals(format))
- {
- MiniProfiler.Start(ProfileLevel.Verbose);
- }
- else if ("EndRequest".Equals(format))
- {
- MiniProfiler.Stop();
- }
- }
-
- if (this.logger.IsEnabled(level))
- {
- this.logger.Log(level, exception, format, args);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ContentPartDriverCoordinator.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ContentPartDriverCoordinator.cs
deleted file mode 100644
index 6074d5e66..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ContentPartDriverCoordinator.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using JetBrains.Annotations;
-using Orchard.ContentManagement.Handlers;
-using Orchard.ContentManagement.MetaData;
-using Orchard.Logging;
-using Orchard.Environment.Extensions;
-using Four2n.Orchard.MiniProfiler.Services;
-using Orchard.ContentManagement.Drivers;
-using Orchard.ContentManagement;
-using Orchard;
-using System;
-
-namespace Four2n.MiniProfilter.Overrides {
- [OrchardSuppressDependency("Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator")]
- public class ProfilingContentPartDriverCoordinator : ContentHandlerBase {
- private readonly IEnumerable _drivers;
- private readonly IContentDefinitionManager _contentDefinitionManager;
- private readonly IProfilerService _profiler;
-
- public ProfilingContentPartDriverCoordinator(IEnumerable drivers, IContentDefinitionManager contentDefinitionManager, IProfilerService profiler) {
- _drivers = drivers;
- _contentDefinitionManager = contentDefinitionManager;
- Logger = NullLogger.Instance;
- _profiler = profiler;
- }
-
- public ILogger Logger { get; set; }
-
- public override void Activating(ActivatingContentContext context) {
- var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(context.ContentType);
- if (contentTypeDefinition == null)
- return;
-
- var partInfos = _drivers.SelectMany(cpp => cpp.GetPartInfo());
-
- foreach (var typePartDefinition in contentTypeDefinition.Parts) {
- var partName = typePartDefinition.PartDefinition.Name;
- var partInfo = partInfos.FirstOrDefault(pi => pi.PartName == partName);
- var part = partInfo != null
- ? partInfo.Factory(typePartDefinition)
- : new ContentPart { TypePartDefinition = typePartDefinition };
- context.Builder.Weld(part);
- }
- }
-
- public override void GetContentItemMetadata(GetContentItemMetadataContext context) {
- _drivers.Invoke(driver => driver.GetContentItemMetadata(context), Logger);
- }
-
- public override void BuildDisplay(BuildDisplayContext context) {
- _drivers.Invoke(driver => {
- var key = "Driver:"+driver.GetType().FullName;
- _profiler.StepStart(key, String.Format("ContentPartDriver: {0}", driver.GetType().FullName));
- var result = driver.BuildDisplay(context);
-
- if (result != null) {
- var key2 = "DriverApply:" + driver.GetType().FullName;
- _profiler.StepStart(key2, String.Format("ApplyDriver", driver.GetType().FullName));
- result.Apply(context);
- _profiler.StepStop(key2);
- }
-
- _profiler.StepStop(key);
-
- }, Logger);
- }
-
- public override void BuildEditor(BuildEditorContext context) {
- _drivers.Invoke(driver => {
- var result = driver.BuildEditor(context);
- if (result != null)
- result.Apply(context);
- }, Logger);
- }
-
- public override void UpdateEditor(UpdateEditorContext context) {
- _drivers.Invoke(driver => {
- var result = driver.UpdateEditor(context);
- if (result != null)
- result.Apply(context);
- }, Logger);
- }
-
- public override void Importing(ImportContentContext context) {
- foreach (var contentPartDriver in _drivers) {
- contentPartDriver.Importing(context);
- }
- }
-
- public override void Imported(ImportContentContext context) {
- foreach (var contentPartDriver in _drivers) {
- contentPartDriver.Imported(context);
- }
- }
-
- public override void Exporting(ExportContentContext context) {
- foreach (var contentPartDriver in _drivers) {
- contentPartDriver.Exporting(context);
- }
- }
-
- public override void Exported(ExportContentContext context) {
- foreach (var contentPartDriver in _drivers) {
- contentPartDriver.Exported(context);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/DefaultContentDisplay.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/DefaultContentDisplay.cs
deleted file mode 100644
index c88155173..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/DefaultContentDisplay.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.Routing;
-using ClaySharp.Implementation;
-using Orchard.ContentManagement.Handlers;
-using Orchard.DisplayManagement;
-using Orchard.DisplayManagement.Descriptors;
-using Orchard.FileSystems.VirtualPath;
-using Orchard.Logging;
-using Orchard.UI.Zones;
-using Orchard.Environment.Extensions;
-using Four2n.Orchard.MiniProfiler.Services;
-
-namespace Orchard.ContentManagement {
- [OrchardSuppressDependency("Orchard.ContentManagement.DefaultContentDisplay")]
- public class ProfilingContentDisplay : IContentDisplay {
- private readonly Lazy> _handlers;
- private readonly IShapeFactory _shapeFactory;
- private readonly Lazy _shapeTableLocator;
-
- private readonly RequestContext _requestContext;
- private readonly IVirtualPathProvider _virtualPathProvider;
- private readonly IWorkContextAccessor _workContextAccessor;
- private readonly IProfilerService _profiler;
- public ProfilingContentDisplay(
- Lazy> handlers,
- IShapeFactory shapeFactory,
- Lazy shapeTableLocator,
- RequestContext requestContext,
- IVirtualPathProvider virtualPathProvider,
- IWorkContextAccessor workContextAccessor,
- IProfilerService profiler) {
-
- _handlers = handlers;
- _shapeFactory = shapeFactory;
- _shapeTableLocator = shapeTableLocator;
- _requestContext = requestContext;
- _virtualPathProvider = virtualPathProvider;
- _workContextAccessor = workContextAccessor;
- _profiler = profiler;
-
- Logger = NullLogger.Instance;
- }
-
- public ILogger Logger { get; set; }
-
- public dynamic BuildDisplay(IContent content, string displayType, string groupId) {
- var contentKey = "ContentDisplay:" + content.Id.ToString();
- _profiler.StepStart(contentKey, String.Format("Content Display: {0} ({1})", content.Id, displayType));
- var contentTypeDefinition = content.ContentItem.TypeDefinition;
- string stereotype;
- if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
- stereotype = "Content";
-
- var actualShapeType = stereotype;
- var actualDisplayType = string.IsNullOrWhiteSpace(displayType) ? "Detail" : displayType;
-
- dynamic itemShape = CreateItemShape(actualShapeType);
- itemShape.ContentItem = content.ContentItem;
- itemShape.Metadata.DisplayType = actualDisplayType;
-
- var context = new BuildDisplayContext(itemShape, content, actualDisplayType, groupId, _shapeFactory);
- BindPlacement(context, actualDisplayType, stereotype);
-
- _handlers.Value.Invoke(handler => {
- var key = String.Format("ContentDisplay:{0}:{1}", content.Id, handler.GetType().FullName);
- _profiler.StepStart(key, String.Format("Content Display: {0}", handler.GetType().FullName));
- handler.BuildDisplay(context);
- _profiler.StepStop(key);
- }, Logger);
- _profiler.StepStop(contentKey);
- return context.Shape;
- }
-
- public dynamic BuildEditor(IContent content, string groupId) {
- var contentKey = "ContentEditor:" + content.Id.ToString();
- _profiler.StepStart(contentKey, String.Format("Content Editor: {0}", content.Id));
- var contentTypeDefinition = content.ContentItem.TypeDefinition;
- string stereotype;
- if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
- stereotype = "Content";
-
- var actualShapeType = stereotype + "_Edit";
-
- dynamic itemShape = CreateItemShape(actualShapeType);
- itemShape.ContentItem = content.ContentItem;
-
- var context = new BuildEditorContext(itemShape, content, groupId, _shapeFactory);
- BindPlacement(context, null, stereotype);
-
- _handlers.Value.Invoke(handler => {
- var key = String.Format("ContentEditor:{0}:{1}", content.Id, handler.GetType().FullName);
- _profiler.StepStart(key, String.Format("Content Editor: {0}", content.Id));
- handler.BuildEditor(context);
- _profiler.StepStop(key);
- }
- , Logger);
-
- _profiler.StepStop(contentKey);
- return context.Shape;
- }
-
- public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupInfoId) {
- var contentKey = "ContentUpdate:" + content.Id.ToString();
- _profiler.StepStart(contentKey, String.Format("Content Update: {0}", content.Id));
- var contentTypeDefinition = content.ContentItem.TypeDefinition;
- string stereotype;
- if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
- stereotype = "Content";
-
- var actualShapeType = stereotype + "_Edit";
-
- dynamic itemShape = CreateItemShape(actualShapeType);
- itemShape.ContentItem = content.ContentItem;
-
- var theme = _workContextAccessor.GetContext().CurrentTheme;
- var shapeTable = _shapeTableLocator.Value.Lookup(theme.Id);
-
- var context = new UpdateEditorContext(itemShape, content, updater, groupInfoId, _shapeFactory, shapeTable);
- BindPlacement(context, null, stereotype);
-
- _handlers.Value.Invoke(handler => {
- var key = String.Format("ContentUpdate:{0}:{1}", content.Id, handler.GetType().FullName);
- _profiler.StepStart(key, String.Format("Content Update: {0}", handler.GetType().FullName));
- handler.UpdateEditor(context);
- _profiler.StepStop(key);
-
- }, Logger);
-
- _profiler.StepStop(contentKey);
- return context.Shape;
- }
-
- private dynamic CreateItemShape(string actualShapeType) {
- Func call = () => _shapeFactory.Create("ContentZone", Arguments.Empty());
- var zoneHoldingBehavior = new ZoneHoldingBehavior(call, _workContextAccessor.GetContext().Layout);
- return _shapeFactory.Create(actualShapeType, Arguments.Empty(), new[] { zoneHoldingBehavior });
- }
-
- private void BindPlacement(BuildShapeContext context, string displayType, string stereotype) {
- context.FindPlacement = (partShapeType, differentiator, defaultLocation) => {
-
- var workContext = _workContextAccessor.GetContext(_requestContext.HttpContext);
-
- var theme = workContext.CurrentTheme;
- var shapeTable = _shapeTableLocator.Value.Lookup(theme.Id);
-
- var request = _requestContext.HttpContext.Request;
-
- ShapeDescriptor descriptor;
- if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) {
- var placementContext = new ShapePlacementContext {
- ContentType = context.ContentItem.ContentType,
- Stereotype = stereotype,
- DisplayType = displayType,
- Differentiator = differentiator,
- Path = VirtualPathUtility.AppendTrailingSlash(_virtualPathProvider.ToAppRelative(request.Path)) // get the current app-relative path, i.e. ~/my-blog/foo
- };
-
- // define which location should be used if none placement is hit
- descriptor.DefaultPlacement = defaultLocation;
-
- var placement = descriptor.Placement(placementContext);
- if (placement != null) {
- placement.Source = placementContext.Source;
- return placement;
- }
- }
-
- return new PlacementInfo {
- Location = defaultLocation,
- Source = String.Empty
- };
- };
- }
- }
-}
diff --git a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ProfilingOrchardEventBus.cs b/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ProfilingOrchardEventBus.cs
deleted file mode 100644
index c92c36c1e..000000000
--- a/src/Orchard.Web/Modules/Four2n.MiniProfiler/Overrides/ProfilingOrchardEventBus.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Orchard.Exceptions;
-using Orchard.Localization;
-
-using Orchard.Events;
-using Orchard.Environment.Extensions;
-using Four2n.Orchard.MiniProfiler.Services;
-
-namespace Four2n.Orchard.MiniProfiler.Overrides {
- [OrchardSuppressDependency("Orchard.Events.DefaultOrchardEventBus")]
- public class DefaultOrchardEventBus : IEventBus {
- private readonly Func> _eventHandlers;
- private readonly IExceptionPolicy _exceptionPolicy;
- private static readonly ConcurrentDictionary _interfaceMethodsCache = new ConcurrentDictionary();
- private readonly IProfilerService _profiler;
- public DefaultOrchardEventBus(Func> eventHandlers, IExceptionPolicy exceptionPolicy, IProfilerService profiler) {
- _eventHandlers = eventHandlers;
- _exceptionPolicy = exceptionPolicy;
- _profiler = profiler;
- T = NullLocalizer.Instance;
- }
-
-
- public Localizer T { get; set; }
-
-
- public IEnumerable Notify(string messageName, IDictionary eventData) {
- // NOTE: We can't profile everything because EventsInterceptor performs some work that's a bit harder to profile without forking or getting our
- // own interceptor working...
- _profiler.StepStart("EventBusNotify","EventBus: "+messageName);
- // call ToArray to ensure evaluation has taken place
- var result = NotifyHandlers(messageName, eventData).ToArray();
- _profiler.StepStop("EventBusNotify");
- return result;
- }
-
- private IEnumerable