From e054a833afae8ba042f4d550c76f04d0c1d8363e Mon Sep 17 00:00:00 2001 From: Daniel Stolt Date: Thu, 9 Jul 2015 11:43:04 +0100 Subject: [PATCH] Removed Orchard.Reports. --- .../profiling-setup-commands.txt | 2 +- .../Bindings/OrchardSiteFactory.cs | 2 +- src/Orchard.Specs/Setup.feature | 8 +- src/Orchard.Specs/Setup.feature.cs | 8 +- .../DataMigration/SchemaBuilderTests.cs | 8 +- .../Orchard.Framework.Tests.csproj | 1 - .../Stubs/StubReportsCoordinator.cs | 14 ---- src/Orchard.Web/Core/Orchard.Core.csproj | 14 +--- src/Orchard.Web/Core/Reports/AdminMenu.cs | 17 ---- .../Reports/Controllers/AdminController.cs | 42 ---------- src/Orchard.Web/Core/Reports/Module.txt | 9 --- src/Orchard.Web/Core/Reports/Routes.cs | 33 -------- .../Core/Reports/Styles/Web.config | 16 ---- .../Reports/Styles/images/menu.reports.png | Bin 219 -> 0 bytes .../Reports/Styles/menu.reports-admin.css | 6 -- .../ViewModels/DisplayReportViewModel.cs | 7 -- .../ViewModels/ReportsAdminIndexViewModel.cs | 8 -- .../Core/Reports/Views/Admin/Display.cshtml | 39 --------- .../Core/Reports/Views/Admin/Index.cshtml | 39 --------- .../Controllers/AdminController.cs | 7 +- .../Controllers/GalleryUpdatesController.cs | 6 +- .../Orchard.Setup/Services/SetupService.cs | 15 ++-- .../Controllers/AdminController.cs | 6 +- .../Upgrade/Controllers/RouteController.cs | 18 ++--- .../Data/Migration/AutomaticDataMigrations.cs | 2 +- .../DefaultDataMigrationInterpreter.cs | 9 +-- src/Orchard/Orchard.Framework.csproj | 9 --- src/Orchard/Reports/Report.cs | 16 ---- src/Orchard/Reports/ReportEntry.cs | 15 ---- src/Orchard/Reports/ReportExtentions.cs | 35 --------- .../Reports/Services/IReportsCoordinator.cs | 30 ------- .../Reports/Services/IReportsManager.cs | 17 ---- .../Reports/Services/IReportsPersister.cs | 14 ---- .../Reports/Services/ReportsCoordinator.cs | 36 --------- .../Reports/Services/ReportsManager.cs | 74 ------------------ .../Reports/Services/ReportsPersister.cs | 67 ---------------- 36 files changed, 38 insertions(+), 611 deletions(-) delete mode 100644 src/Orchard.Tests/Stubs/StubReportsCoordinator.cs delete mode 100644 src/Orchard.Web/Core/Reports/AdminMenu.cs delete mode 100644 src/Orchard.Web/Core/Reports/Controllers/AdminController.cs delete mode 100644 src/Orchard.Web/Core/Reports/Module.txt delete mode 100644 src/Orchard.Web/Core/Reports/Routes.cs delete mode 100644 src/Orchard.Web/Core/Reports/Styles/Web.config delete mode 100644 src/Orchard.Web/Core/Reports/Styles/images/menu.reports.png delete mode 100644 src/Orchard.Web/Core/Reports/Styles/menu.reports-admin.css delete mode 100644 src/Orchard.Web/Core/Reports/ViewModels/DisplayReportViewModel.cs delete mode 100644 src/Orchard.Web/Core/Reports/ViewModels/ReportsAdminIndexViewModel.cs delete mode 100644 src/Orchard.Web/Core/Reports/Views/Admin/Display.cshtml delete mode 100644 src/Orchard.Web/Core/Reports/Views/Admin/Index.cshtml delete mode 100644 src/Orchard/Reports/Report.cs delete mode 100644 src/Orchard/Reports/ReportEntry.cs delete mode 100644 src/Orchard/Reports/ReportExtentions.cs delete mode 100644 src/Orchard/Reports/Services/IReportsCoordinator.cs delete mode 100644 src/Orchard/Reports/Services/IReportsManager.cs delete mode 100644 src/Orchard/Reports/Services/IReportsPersister.cs delete mode 100644 src/Orchard/Reports/Services/ReportsCoordinator.cs delete mode 100644 src/Orchard/Reports/Services/ReportsManager.cs delete mode 100644 src/Orchard/Reports/Services/ReportsPersister.cs diff --git a/src/Orchard.Profile/profiling-setup-commands.txt b/src/Orchard.Profile/profiling-setup-commands.txt index 4d3228c37..54db7fc5a 100644 --- a/src/Orchard.Profile/profiling-setup-commands.txt +++ b/src/Orchard.Profile/profiling-setup-commands.txt @@ -1 +1 @@ -setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,Navigation,Reports,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.MediaLibrary,Orchard.ContentPicker,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine,Orchard.Tokens,Orchard.Alias,Orchard.Autoroute +setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,Navigation,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.MediaLibrary,Orchard.ContentPicker,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine,Orchard.Tokens,Orchard.Alias,Orchard.Autoroute diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index f83c47868..145113353 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -25,7 +25,7 @@ namespace Orchard.Specs.Bindings { virtualDirectory, TableData( new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.CustomForms, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.jQuery, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.Media, Orchard.MediaLibrary, Orchard.MediaPicker, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Rules, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.TaskLease, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, SysCache, TinyMce, Upgrade" }, - new { extension = "Core", names = "Common, Containers, Contents, Dashboard, Feeds, Navigation, Reports, Scheduling, Settings, Shapes, Title, XmlRpc" }, + new { extension = "Core", names = "Common, Containers, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Title, XmlRpc" }, new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); webApp.WhenIGoTo("Setup"); diff --git a/src/Orchard.Specs/Setup.feature b/src/Orchard.Specs/Setup.feature index de394b9de..2e8664a74 100644 --- a/src/Orchard.Specs/Setup.feature +++ b/src/Orchard.Specs/Setup.feature @@ -7,7 +7,7 @@ Scenario: Root request shows setup form Given I have a clean site with | extension | names | | Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp | - | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title, Reports | + | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title | | Theme | SafeMode | When I go to "/" Then I should see "Welcome to Orchard" @@ -18,7 +18,7 @@ Scenario: Setup folder also shows setup form Given I have a clean site with | extension | names | | Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp | - | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title, Reports | + | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title | | Theme | SafeMode | When I go to "/Setup" Then I should see "Welcome to Orchard" @@ -29,7 +29,7 @@ Scenario: Some of the initial form values are required Given I have a clean site with | extension | names | | Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp | - | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title, Reports | + | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title | | Theme | SafeMode | When I go to "/Setup" And I hit "Finish Setup" @@ -41,7 +41,7 @@ Scenario: Calling setup on a brand new install Given I have a clean site with | extension | names | | Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp | - | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title, Reports | + | Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title | | Theme | SafeMode, TheAdmin, TheThemeMachine | And I am on "/Setup" When I fill in diff --git a/src/Orchard.Specs/Setup.feature.cs b/src/Orchard.Specs/Setup.feature.cs index a46b066ef..751f02836 100644 --- a/src/Orchard.Specs/Setup.feature.cs +++ b/src/Orchard.Specs/Setup.feature.cs @@ -82,7 +82,7 @@ this.ScenarioSetup(scenarioInfo); table1.AddRow(new string[] { "Core", "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," + - " Shapes, XmlRpc, Title, Reports"}); + " Shapes, XmlRpc, Title"}); table1.AddRow(new string[] { "Theme", "SafeMode"}); @@ -117,7 +117,7 @@ this.ScenarioSetup(scenarioInfo); table2.AddRow(new string[] { "Core", "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," + - " Shapes, XmlRpc, Title, Reports"}); + " Shapes, XmlRpc, Title"}); table2.AddRow(new string[] { "Theme", "SafeMode"}); @@ -152,7 +152,7 @@ this.ScenarioSetup(scenarioInfo); table3.AddRow(new string[] { "Core", "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," + - " Shapes, XmlRpc, Title, Reports"}); + " Shapes, XmlRpc, Title"}); table3.AddRow(new string[] { "Theme", "SafeMode"}); @@ -189,7 +189,7 @@ this.ScenarioSetup(scenarioInfo); table4.AddRow(new string[] { "Core", "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," + - " Shapes, XmlRpc, Title, Reports"}); + " Shapes, XmlRpc, Title"}); table4.AddRow(new string[] { "Theme", "SafeMode, TheAdmin, TheThemeMachine"}); diff --git a/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs b/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs index b2971aca5..d145cdea2 100644 --- a/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs +++ b/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs @@ -12,15 +12,14 @@ using Orchard.Environment; using Orchard.Environment.Configuration; using Orchard.Environment.ShellBuilders.Models; using Orchard.FileSystems.AppData; -using Orchard.Reports.Services; using Orchard.Tests.ContentManagement; using System.IO; using Orchard.Tests.Environment; using Orchard.Tests.FileSystems.AppData; -using Orchard.Tests.Stubs; -namespace Orchard.Tests.DataMigration { - [TestFixture] +namespace Orchard.Tests.DataMigration +{ + [TestFixture] public class SchemaBuilderTestsBase { private IContainer _container; private ISessionFactory _sessionFactory; @@ -45,7 +44,6 @@ namespace Orchard.Tests.DataMigration { builder.RegisterInstance(appDataFolder).As(); builder.RegisterType().As(); builder.RegisterType().As(); - builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); diff --git a/src/Orchard.Tests/Orchard.Framework.Tests.csproj b/src/Orchard.Tests/Orchard.Framework.Tests.csproj index 5d2c100b1..21bdeff09 100644 --- a/src/Orchard.Tests/Orchard.Framework.Tests.csproj +++ b/src/Orchard.Tests/Orchard.Framework.Tests.csproj @@ -281,7 +281,6 @@ - diff --git a/src/Orchard.Tests/Stubs/StubReportsCoordinator.cs b/src/Orchard.Tests/Stubs/StubReportsCoordinator.cs deleted file mode 100644 index 0621a0c5d..000000000 --- a/src/Orchard.Tests/Stubs/StubReportsCoordinator.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Orchard.Reports; -using Orchard.Reports.Services; - -namespace Orchard.Tests.Stubs { - public class StubReportsCoordinator : IReportsCoordinator { - public void Add(string reportKey, ReportEntryType type, string message) { - - } - - public int Register(string reportKey, string activityName, string title) { - return 0; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index eaa488e62..1fd2dc6b2 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -25,6 +25,7 @@ + true @@ -175,12 +176,7 @@ - - - - - @@ -314,11 +310,6 @@ - - - - - @@ -434,9 +425,6 @@ Designer - - - diff --git a/src/Orchard.Web/Core/Reports/AdminMenu.cs b/src/Orchard.Web/Core/Reports/AdminMenu.cs deleted file mode 100644 index 1a48c91f5..000000000 --- a/src/Orchard.Web/Core/Reports/AdminMenu.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Orchard.Localization; -using Orchard.Security; -using Orchard.UI.Navigation; - -namespace Orchard.Core.Reports { - public class AdminMenu : INavigationProvider { - public Localizer T { get; set; } - public string MenuName { get { return "admin"; } } - - public void GetNavigation(NavigationBuilder builder) { - builder.AddImageSet("reports") - .Add(T("Reports"), "12", - menu => menu.Add(T("View"), "0", item => item.Action("Index", "Admin", new { area = "Reports" }) - .Permission(StandardPermissions.SiteOwner))); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Reports/Controllers/AdminController.cs b/src/Orchard.Web/Core/Reports/Controllers/AdminController.cs deleted file mode 100644 index 07008d078..000000000 --- a/src/Orchard.Web/Core/Reports/Controllers/AdminController.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Linq; -using System.Web.Mvc; -using Orchard.Core.Reports.ViewModels; -using Orchard.Localization; -using Orchard.Reports.Services; -using Orchard.Security; - -namespace Orchard.Core.Reports.Controllers { - public class AdminController : Controller { - private readonly IReportsManager _reportsManager; - - public AdminController( - IOrchardServices services, - IReportsManager reportsManager) { - Services = services; - _reportsManager = reportsManager; - T = NullLocalizer.Instance; - } - - public IOrchardServices Services { get; set; } - public Localizer T { get; set; } - - public ActionResult Index() { - if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to list reports"))) - return new HttpUnauthorizedResult(); - - var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() }; - - return View(model); - } - - public ActionResult Display(int id) { - if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to display report"))) - return new HttpUnauthorizedResult(); - - var model = new DisplayReportViewModel { Report = _reportsManager.Get(id) }; - - return View(model); - } - - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Reports/Module.txt b/src/Orchard.Web/Core/Reports/Module.txt deleted file mode 100644 index b7eea56cd..000000000 --- a/src/Orchard.Web/Core/Reports/Module.txt +++ /dev/null @@ -1,9 +0,0 @@ -Name: Reports -AntiForgery: enabled -Author: The Orchard Team -Website: http://orchardproject.net -Version: 1.9.1 -OrchardVersion: 1.9 -Description: The dashboard module is providing the reports screen of the application. -FeatureDescription: Reports management. -Category: Core diff --git a/src/Orchard.Web/Core/Reports/Routes.cs b/src/Orchard.Web/Core/Reports/Routes.cs deleted file mode 100644 index c3e286fa8..000000000 --- a/src/Orchard.Web/Core/Reports/Routes.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections.Generic; -using System.Web.Mvc; -using System.Web.Routing; -using Orchard.Mvc.Routes; - -namespace Orchard.Core.Reports { - public class Routes : IRouteProvider { - public void GetRoutes(ICollection routes) { - foreach (var routeDescriptor in GetRoutes()) - routes.Add(routeDescriptor); - } - - public IEnumerable GetRoutes() { - return new[] { - new RouteDescriptor { - Priority = -5, - Route = new Route( - "Admin/Reports", - new RouteValueDictionary { - {"area", "Reports"}, - {"controller", "Admin"}, - {"action", "Index"} - }, - new RouteValueDictionary(), - new RouteValueDictionary { - {"area", "Reports"} - }, - new MvcRouteHandler()) - } - }; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Reports/Styles/Web.config b/src/Orchard.Web/Core/Reports/Styles/Web.config deleted file mode 100644 index 74c71f22b..000000000 --- a/src/Orchard.Web/Core/Reports/Styles/Web.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Core/Reports/Styles/images/menu.reports.png b/src/Orchard.Web/Core/Reports/Styles/images/menu.reports.png deleted file mode 100644 index e10c05e853af48a1e459d1c57ab309d760c45411..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^0zhoQ#0(@;4TX*XDdu7)&kzm{j@u9Y9{{-L1;Fyx1l&avCS(I9yUzA;};2dniw(0T$pgJQ@7sn8enaK$a%*#SoOG(U-ka*C- z##6$(u9PRga% Reports { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Reports/Views/Admin/Display.cshtml b/src/Orchard.Web/Core/Reports/Views/Admin/Display.cshtml deleted file mode 100644 index 6eb95e422..000000000 --- a/src/Orchard.Web/Core/Reports/Views/Admin/Display.cshtml +++ /dev/null @@ -1,39 +0,0 @@ -@model DisplayReportViewModel -@using Orchard.Core.Reports.ViewModels; - -@{ Layout.Title = T("Display Report").ToString(); } - -@using(Html.BeginFormAntiForgeryPost()) { - @Html.ValidationSummary() -
- - - - - - - - - - - - - - - - @foreach (var reportEntry in Model.Report.Entries) { - - - - - - } -
@T("Type")@T("Message")@T("Date")
- @reportEntry.Type - - @reportEntry.Message - - @reportEntry.Utc.ToLocalTime().ToShortDateString() @reportEntry.Utc.ToLocalTime().ToShortTimeString() -
-
-} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Reports/Views/Admin/Index.cshtml b/src/Orchard.Web/Core/Reports/Views/Admin/Index.cshtml deleted file mode 100644 index fbfb66dca..000000000 --- a/src/Orchard.Web/Core/Reports/Views/Admin/Index.cshtml +++ /dev/null @@ -1,39 +0,0 @@ -@model ReportsAdminIndexViewModel -@using Orchard.Core.Reports.ViewModels; - -@{ Layout.Title = T("Reports").ToString(); } - -@using(Html.BeginFormAntiForgeryPost()) { - @Html.ValidationSummary() -
- - - - - - - - - - - - - - - - @foreach (var report in Model.Reports) { - - - - - - } -
@T("Name")@T("Title")@T("Date")
- @Html.ActionLink(report.ActivityName, "Display", new {id = report.ReportId}) - - @report.Title - - @report.Utc.ToLocalTime().ToShortDateString() @report.Utc.ToLocalTime().ToShortTimeString() -
-
-} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs index 1cad73228..dc8e302b1 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs @@ -19,7 +19,6 @@ using Orchard.Mvc; using Orchard.Mvc.Extensions; using Orchard.Recipes.Models; using Orchard.Recipes.Services; -using Orchard.Reports.Services; using Orchard.Security; using Orchard.UI.Navigation; using Orchard.UI.Notify; @@ -29,7 +28,6 @@ namespace Orchard.Modules.Controllers { private readonly IExtensionDisplayEventHandler _extensionDisplayEventHandler; private readonly IModuleService _moduleService; private readonly IDataMigrationManager _dataMigrationManager; - private readonly IReportsCoordinator _reportsCoordinator; private readonly IExtensionManager _extensionManager; private readonly IFeatureManager _featureManager; private readonly IRecipeHarvester _recipeHarvester; @@ -42,7 +40,6 @@ namespace Orchard.Modules.Controllers { IOrchardServices services, IModuleService moduleService, IDataMigrationManager dataMigrationManager, - IReportsCoordinator reportsCoordinator, IExtensionManager extensionManager, IFeatureManager featureManager, IRecipeHarvester recipeHarvester, @@ -55,7 +52,6 @@ namespace Orchard.Modules.Controllers { _extensionDisplayEventHandler = extensionDisplayEventHandlers.FirstOrDefault(); _moduleService = moduleService; _dataMigrationManager = dataMigrationManager; - _reportsCoordinator = reportsCoordinator; _extensionManager = extensionManager; _featureManager = featureManager; _recipeHarvester = recipeHarvester; @@ -233,7 +229,8 @@ namespace Orchard.Modules.Controllers { foreach (var feature in selectedFeaturesThatNeedUpdate) { var id = feature.Descriptor.Id; try { - _reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation"); + // TODO: LOGGING + //_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation"); _dataMigrationManager.Update(id); Services.Notifier.Information(T("The feature {0} was updated successfully", id)); } diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryUpdatesController.cs b/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryUpdatesController.cs index 782622d3c..b6374b968 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryUpdatesController.cs +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryUpdatesController.cs @@ -11,15 +11,15 @@ using Orchard.Mvc.Extensions; using Orchard.Packaging.Models; using Orchard.Packaging.Services; using Orchard.Packaging.ViewModels; -using Orchard.Reports.Services; using Orchard.Security; using Orchard.Themes; using Orchard.UI.Admin; using Orchard.UI.Navigation; using Orchard.UI.Notify; -namespace Orchard.Packaging.Controllers { - [OrchardFeature("Gallery.Updates")] +namespace Orchard.Packaging.Controllers +{ + [OrchardFeature("Gallery.Updates")] [Themed, Admin] public class GalleryUpdatesController : Controller { private readonly ShellSettings _shellSettings; diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index dbb546260..74a8e0f04 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Security.Cryptography; using System.Web; using Orchard.ContentManagement; -using Orchard.Core.Settings.Descriptor.Records; using Orchard.Core.Settings.Models; using Orchard.Data; using Orchard.Data.Migration; @@ -15,20 +14,19 @@ using Orchard.Environment.Configuration; using Orchard.Environment.Descriptor; using Orchard.Environment.Descriptor.Models; using Orchard.Environment.Extensions; -using Orchard.Environment.Extensions.Models; using Orchard.Environment.ShellBuilders; using Orchard.Environment.State; using Orchard.Localization; using Orchard.Localization.Services; using Orchard.Recipes.Models; using Orchard.Recipes.Services; -using Orchard.Reports.Services; using Orchard.Security; using Orchard.Settings; using Orchard.Utility.Extensions; -namespace Orchard.Setup.Services { - public class SetupService : ISetupService { +namespace Orchard.Setup.Services +{ + public class SetupService : ISetupService { private readonly ShellSettings _shellSettings; private readonly IOrchardHost _orchardHost; private readonly IShellSettingsManager _shellSettingsManager; @@ -87,7 +85,7 @@ namespace Orchard.Setup.Services { // Framework "Orchard.Framework", // Core - "Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation", "Reports", "Scheduling", "Settings", "Shapes", "Title", + "Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation","Scheduling", "Settings", "Shapes", "Title", // Modules "Orchard.Pages", "Orchard.ContentPicker", "Orchard.Themes", "Orchard.Users", "Orchard.Roles", "Orchard.Modules", "PackagingServices", "Orchard.Packaging", "Gallery", "Orchard.Recipes" @@ -144,9 +142,8 @@ namespace Orchard.Setup.Services { // Make a workaround to avoid the Transaction issue for PostgreSQL environment.Resolve().RequireNew(); - var reportsCoordinator = environment.Resolve(); - - reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation"); + // TODO: LOGGING + //reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation"); schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table diff --git a/src/Orchard.Web/Modules/Orchard.Themes/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Themes/Controllers/AdminController.cs index a3620d099..8679b171b 100644 --- a/src/Orchard.Web/Modules/Orchard.Themes/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Themes/Controllers/AdminController.cs @@ -12,7 +12,6 @@ using Orchard.Localization; using Orchard.Logging; using Orchard.Mvc; using Orchard.Mvc.Extensions; -using Orchard.Reports.Services; using Orchard.Security; using Orchard.Themes.Events; using Orchard.Themes.Models; @@ -34,7 +33,6 @@ namespace Orchard.Themes.Controllers { private readonly ShellDescriptor _shellDescriptor; private readonly IPreviewTheme _previewTheme; private readonly IThemeService _themeService; - private readonly IReportsCoordinator _reportsCoordinator; private readonly ShellSettings _shellSettings; public AdminController( @@ -47,7 +45,6 @@ namespace Orchard.Themes.Controllers { ShellDescriptor shellDescriptor, IPreviewTheme previewTheme, IThemeService themeService, - IReportsCoordinator reportsCoordinator, ShellSettings shellSettings) { Services = services; @@ -59,7 +56,6 @@ namespace Orchard.Themes.Controllers { _featureManager = featureManager; _previewTheme = previewTheme; _themeService = themeService; - _reportsCoordinator = reportsCoordinator; _shellSettings = shellSettings; T = NullLocalizer.Instance; @@ -232,7 +228,7 @@ namespace Orchard.Themes.Controllers { return HttpNotFound(); try { - _reportsCoordinator.Register("Data Migration", "Upgrade " + themeId, "Orchard installation"); + // TODO: LOGGING _dataMigrationManager.Update(themeId); Services.Notifier.Information(T("The theme {0} was updated successfully", themeId)); } catch (Exception exception) { diff --git a/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs b/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs index 655ef2058..927865c9b 100644 --- a/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs +++ b/src/Orchard.Web/Modules/Upgrade/Controllers/RouteController.cs @@ -13,7 +13,6 @@ using Orchard.Core.Title.Models; using Orchard.Data; using Orchard.Environment.Configuration; using Orchard.Localization; -using Orchard.Reports.Services; using Orchard.Security; using Orchard.UI.Admin; using Orchard.UI.Notify; @@ -27,21 +26,18 @@ namespace Upgrade.Controllers { private readonly ISessionFactoryHolder _sessionFactoryHolder; private readonly ShellSettings _shellSettings; private readonly IAutorouteService _autorouteService; - private readonly IReportsCoordinator _reportsCoordinator; public RouteController( IContentDefinitionManager contentDefinitionManager, IOrchardServices orchardServices, ISessionFactoryHolder sessionFactoryHolder, ShellSettings shellSettings, - IAutorouteService autorouteService, - IReportsCoordinator reportsCoordinator) { + IAutorouteService autorouteService) { _contentDefinitionManager = contentDefinitionManager; _orchardServices = orchardServices; _sessionFactoryHolder = sessionFactoryHolder; _shellSettings = shellSettings; _autorouteService = autorouteService; - _reportsCoordinator = reportsCoordinator; } public Localizer T { get; set; } @@ -71,8 +67,8 @@ namespace Upgrade.Controllers { if(TryUpdateModel(viewModel)) { - // creating report - _reportsCoordinator.Register("Migration", "Upgrade", "Migrating " + string.Join(" ,", viewModel.ContentTypes.Where(x => x.IsChecked).Select(x => x.ContentTypeName).ToArray())); + // TODO: LOGGING + //_reportsCoordinator.Register("Migration", "Upgrade", "Migrating " + string.Join(" ,", viewModel.ContentTypes.Where(x => x.IsChecked).Select(x => x.ContentTypeName).ToArray())); var contentTypesToMigrate = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName); @@ -81,7 +77,8 @@ namespace Upgrade.Controllers { foreach (var contentType in contentTypesToMigrate) { - _reportsCoordinator.Information("Migration", "Adding parts to " + contentType); + // TODO: LOGGING + //_reportsCoordinator.Information("Migration", "Adding parts to " + contentType); // migrating parts _contentDefinitionManager.AlterTypeDefinition(contentType, @@ -133,8 +130,9 @@ namespace Upgrade.Controllers { if (!reader.IsClosed) { reader.Close(); } - - _reportsCoordinator.Error("Migration", "Migrating content item " + autoroutePart.ContentItem.Id + " failed with: " + e.Message); + + // TODO: LOGGING + //_reportsCoordinator.Error("Migration", "Migrating content item " + autoroutePart.ContentItem.Id + " failed with: " + e.Message); errors = true; } } diff --git a/src/Orchard/Data/Migration/AutomaticDataMigrations.cs b/src/Orchard/Data/Migration/AutomaticDataMigrations.cs index 2a6e1ed49..f592f30fc 100644 --- a/src/Orchard/Data/Migration/AutomaticDataMigrations.cs +++ b/src/Orchard/Data/Migration/AutomaticDataMigrations.cs @@ -28,7 +28,7 @@ namespace Orchard.Data.Migration { // Let's make sure that the basic set of features is enabled. If there are any that are not enabled, then let's enable them first. var theseFeaturesShouldAlwaysBeActive = new[] { - "Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation", "Reports", "Scheduling", "Settings", "Shapes", "Title" + "Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation", "Scheduling", "Settings", "Shapes", "Title" }; var enabledFeatures = _featureManager.GetEnabledFeatures().Select(f => f.Id).ToList(); diff --git a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs index a58a53f11..938ca6b89 100644 --- a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs @@ -11,7 +11,6 @@ using Orchard.Data.Migration.Schema; using Orchard.Environment.Configuration; using Orchard.Localization; using Orchard.Logging; -using Orchard.Reports.Services; namespace Orchard.Data.Migration.Interpreters { public class DefaultDataMigrationInterpreter : AbstractDataMigrationInterpreter, IDataMigrationInterpreter { @@ -21,7 +20,6 @@ namespace Orchard.Data.Migration.Interpreters { private readonly Lazy _dialectLazy; private readonly List _sqlStatements; private readonly ISessionFactoryHolder _sessionFactoryHolder; - private readonly IReportsCoordinator _reportsCoordinator; private const char Space = ' '; @@ -29,14 +27,12 @@ namespace Orchard.Data.Migration.Interpreters { ShellSettings shellSettings, ISessionLocator sessionLocator, IEnumerable commandInterpreters, - ISessionFactoryHolder sessionFactoryHolder, - IReportsCoordinator reportsCoordinator) { + ISessionFactoryHolder sessionFactoryHolder) { _shellSettings = shellSettings; _sessionLocator = sessionLocator; _commandInterpreters = commandInterpreters; _sqlStatements = new List(); _sessionFactoryHolder = sessionFactoryHolder; - _reportsCoordinator = reportsCoordinator; Logger = NullLogger.Instance; T = NullLocalizer.Instance; @@ -341,7 +337,8 @@ namespace Orchard.Data.Migration.Interpreters { command.ExecuteNonQuery(); } - _reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement)); + // TODO: LOGGING + //_reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement)); } } finally { diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index 49ea011e9..d59662de5 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -723,15 +723,6 @@ - - - - - - - - - diff --git a/src/Orchard/Reports/Report.cs b/src/Orchard/Reports/Report.cs deleted file mode 100644 index 5b557ba9f..000000000 --- a/src/Orchard/Reports/Report.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Orchard.Reports { - public class Report { - public Report() { - Entries = new List(); - } - - public IList Entries { get; set;} - public int ReportId { get; set; } - public string Title { get; set; } - public string ActivityName { get; set; } - public DateTime Utc { get; set; } - } -} diff --git a/src/Orchard/Reports/ReportEntry.cs b/src/Orchard/Reports/ReportEntry.cs deleted file mode 100644 index 482f89e22..000000000 --- a/src/Orchard/Reports/ReportEntry.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Orchard.Reports { - public enum ReportEntryType { - Information, - Warning, - Error - } - - public class ReportEntry { - public ReportEntryType Type { get; set; } - public string Message { get; set; } - public DateTime Utc { get; set; } - } -} diff --git a/src/Orchard/Reports/ReportExtentions.cs b/src/Orchard/Reports/ReportExtentions.cs deleted file mode 100644 index 2ebb2ff01..000000000 --- a/src/Orchard/Reports/ReportExtentions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Orchard.Reports; -using Orchard.Reports.Services; - -public static class ReportExtentions { - /// - /// Adds a new report entry of type information to a report that was previously registered. - /// - /// - /// Key, i.e. technical name of the report. Should be the same as the one used when registering the report. - /// The message to include in the entry. - public static void Information(this IReportsCoordinator reportCoordinator, string reportKey, string message) { - reportCoordinator.Add(reportKey, ReportEntryType.Information, message); - } - - /// - /// Adds a new report entry of type warning to a report that was previously registered. - /// - /// - /// Key, i.e. technical name of the report. Should be the same as the one used when registering the report. - /// The message to include in the entry. - public static void Warning(this IReportsCoordinator reportCoordinator, string reportKey, string message) { - reportCoordinator.Add(reportKey, ReportEntryType.Warning, message); - } - - /// - /// Adds a new report entry of type error to a report that was previously registered. - /// - /// - /// Key, i.e. technical name of the report. Should be the same as the one used when registering the report. - /// The message to include in the entry. - public static void Error(this IReportsCoordinator reportCoordinator, string reportKey, string message) { - reportCoordinator.Add(reportKey, ReportEntryType.Error, message); - } -} - diff --git a/src/Orchard/Reports/Services/IReportsCoordinator.cs b/src/Orchard/Reports/Services/IReportsCoordinator.cs deleted file mode 100644 index 659f86f91..000000000 --- a/src/Orchard/Reports/Services/IReportsCoordinator.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Orchard.Reports.Services { - /// - /// Exposes a simplified interface for creating reports. Reports provide user-accessible log-like functionality. - /// - /// - /// can be used too to create reports directly. - /// - public interface IReportsCoordinator : IDependency { - /// - /// Adds a new report entry to a report that was previously registered. - /// - /// - /// Entries can be only added to a report that was previously registered through Register(). - /// - /// - /// Key, i.e. technical name of the report. Should be the same as the one used when registering the report. - /// Type of the entry. - /// The message to include in the entry. - void Add(string reportKey, ReportEntryType type, string message); - - /// - /// Registers a new report so entries can be added to it. - /// - /// Key, i.e. technical name of the report. - /// Name of the activity the report is about (e.g. "Upgrade"). - /// A title better describing what the report is about (e.g. "Migrating routes of Pages, Blog Posts"). - /// The report's numerical ID. - int Register(string reportKey, string activityName, string title); - } -} diff --git a/src/Orchard/Reports/Services/IReportsManager.cs b/src/Orchard/Reports/Services/IReportsManager.cs deleted file mode 100644 index f2006adf4..000000000 --- a/src/Orchard/Reports/Services/IReportsManager.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - -namespace Orchard.Reports.Services { - /// - /// Service for handling reports. Reports provide user-accessible log-like functionality. - /// - /// - /// You can use to create reports through a simplified interface. - /// - public interface IReportsManager : ISingletonDependency { - void Add(int reportId, ReportEntryType type, string message); - int CreateReport(string title, string activityName); - Report Get(int reportId); - IEnumerable GetReports(); - void Flush(); - } -} diff --git a/src/Orchard/Reports/Services/IReportsPersister.cs b/src/Orchard/Reports/Services/IReportsPersister.cs deleted file mode 100644 index b79cd9e3b..000000000 --- a/src/Orchard/Reports/Services/IReportsPersister.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; - -namespace Orchard.Reports.Services { - /// - /// Defines a service that can be used to persist reports. - /// - /// - /// Implementations of this interface are commonly used from implementations. - /// - public interface IReportsPersister : IDependency { - IEnumerable Fetch(); - void Save(IEnumerable reports); - } -} diff --git a/src/Orchard/Reports/Services/ReportsCoordinator.cs b/src/Orchard/Reports/Services/ReportsCoordinator.cs deleted file mode 100644 index a399b3bd9..000000000 --- a/src/Orchard/Reports/Services/ReportsCoordinator.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using Orchard.Logging; - -namespace Orchard.Reports.Services { - public class ReportsCoordinator : IReportsCoordinator, IDisposable { - private readonly IReportsManager _reportsManager; - private readonly IDictionary _reports; - - public ReportsCoordinator(IReportsManager reportsManager) { - _reportsManager = reportsManager; - Logger = NullLogger.Instance; - _reports = new Dictionary(); - } - - public ILogger Logger { get; set; } - public void Dispose() { - _reportsManager.Flush(); - } - - public void Add(string reportKey, ReportEntryType type, string message) { - if(!_reports.ContainsKey(reportKey)) { - // ignore message if no corresponding report - return; - } - - _reportsManager.Add(_reports[reportKey], type, message); - } - - public int Register(string reportKey, string activityName, string title) { - int reportId = _reportsManager.CreateReport(title, activityName); - _reports.Add(reportKey, reportId); - return reportId; - } - } -} diff --git a/src/Orchard/Reports/Services/ReportsManager.cs b/src/Orchard/Reports/Services/ReportsManager.cs deleted file mode 100644 index 7928e316a..000000000 --- a/src/Orchard/Reports/Services/ReportsManager.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Orchard.Logging; - -namespace Orchard.Reports.Services { - public class ReportsManager : IReportsManager { - private readonly IReportsPersister _reportsPersister; - private List _reports; - private static readonly object _synLock = new object(); - private bool _isDirty; - - public ReportsManager(IReportsPersister reportsPersister) { - _reportsPersister = reportsPersister; - Logger = NullLogger.Instance; - } - - public ILogger Logger { get; set; } - - public void Add(int reportId, ReportEntryType type, string message) { - lock ( _synLock ) { - LoadReports(); - _isDirty = true; - var report = Get(reportId); - if(report == null) { - return; - } - report.Entries.Add(new ReportEntry {Message = message, Type = type, Utc = DateTime.UtcNow}); - } - } - - public int CreateReport(string title, string activityName) { - lock ( _synLock ) { - LoadReports(); - _isDirty = true; - var reportId = _reports.Count == 0 ? 1 : _reports.Max(r => r.ReportId) + 1; - var report = new Report {ActivityName = activityName, ReportId = reportId, Title = title, Utc = DateTime.UtcNow}; - _reports.Add(report); - return reportId; - } - } - - public Report Get(int reportId) { - lock(_synLock) { - LoadReports(); - return _reports.Where(r => r.ReportId == reportId).FirstOrDefault(); - } - } - - public IEnumerable GetReports() { - lock ( _synLock ) { - LoadReports(); - return _reports.ToList(); - } - } - - public void Flush() { - if ( _reports == null || !_isDirty) { - return; - } - - lock ( _synLock ) { - _reportsPersister.Save(_reports); - _isDirty = false; - } - } - - private void LoadReports() { - if(_reports == null) { - _reports = _reportsPersister.Fetch().ToList(); - } - } - } -} diff --git a/src/Orchard/Reports/Services/ReportsPersister.cs b/src/Orchard/Reports/Services/ReportsPersister.cs deleted file mode 100644 index 49d77d193..000000000 --- a/src/Orchard/Reports/Services/ReportsPersister.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; -using System.Xml; -using System.Xml.Linq; -using Orchard.Environment.Configuration; -using Orchard.FileSystems.AppData; -using System.IO; - -namespace Orchard.Reports.Services { - public class ReportsPersister : IReportsPersister { - private readonly IAppDataFolder _appDataFolder; - private readonly ShellSettings _shellSettings; - private readonly string _reportsFileName; - private readonly DataContractSerializer _dataContractSerializer; - private readonly object _synLock = new object(); - - public ReportsPersister(IAppDataFolder appDataFolder, ShellSettings shellSettings) { - _appDataFolder = appDataFolder; - _shellSettings = shellSettings; - _dataContractSerializer = new DataContractSerializer(typeof(Report), new [] { typeof(ReportEntry) }); - _reportsFileName = Path.Combine(Path.Combine("Sites", _shellSettings.Name), "reports.dat"); - } - - public IEnumerable Fetch() { - lock ( _synLock ) { - if ( !_appDataFolder.FileExists(_reportsFileName) ) { - yield break; - } - - var text = _appDataFolder.ReadFile(_reportsFileName); - var xmlDocument = XDocument.Parse(text); - var rootNode = xmlDocument.Root; - if (rootNode == null) { - yield break; - } - - foreach (var reportNode in rootNode.Elements()) { - var reader = new StringReader(reportNode.Value); - using (var xmlReader = XmlReader.Create(reader)) { - yield return (Report) _dataContractSerializer.ReadObject(xmlReader, true); - } - } - } - } - - public void Save(IEnumerable reports) { - lock ( _synLock ) { - var xmlDocument = new XDocument(); - xmlDocument.Add(new XElement("Reports")); - foreach (var report in reports) { - var reportNode = new XElement("Report"); - var writer = new StringWriter(); - using (var xmlWriter = XmlWriter.Create(writer)) { - _dataContractSerializer.WriteObject(xmlWriter, report); - } - reportNode.Value = writer.ToString(); - xmlDocument.Root.Add(reportNode); - } - - var saveWriter = new StringWriter(); - xmlDocument.Save(saveWriter); - _appDataFolder.CreateFile(_reportsFileName, saveWriter.ToString()); - } - } - } -} -