From afa6327ba0dfd17d42d6a4dfc6ae7efd8a94f35c Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Thu, 21 Apr 2022 23:05:36 -0300 Subject: [PATCH 01/37] Initial commit. --- .../App_LocalResources/View.ascx.resx | 171 ++++++++++++ .../Dnn.Modules.TelerikRemoval.csproj | 172 ++++++++++++ .../TelerikRemoval/Properties/AssemblyInfo.cs | 20 ++ .../UserControls/DnnCheckBox.cs | 83 ++++++ .../UserControls/DnnTextButton.cs | 17 ++ DNN Platform/Modules/TelerikRemoval/View.ascx | 98 +++++++ .../Modules/TelerikRemoval/View.ascx.cs | 209 +++++++++++++++ .../TelerikRemoval/View.ascx.designer.cs | 251 ++++++++++++++++++ .../Modules/TelerikRemoval/Web.Debug.config | 30 +++ .../Modules/TelerikRemoval/Web.Release.config | 31 +++ .../Modules/TelerikRemoval/Web.config | 25 ++ .../Modules/TelerikRemoval/module.css | 21 ++ .../Modules/TelerikRemoval/packages.config | 5 + .../Dnn.Modules.TelerikRemovalLibrary.csproj | 101 +++++++ .../ITelerikUninstaller.cs | 25 ++ .../Impl/FileSystemProvider.cs | 51 ++++ .../Impl/IFileSystemProvider.cs | 38 +++ .../Impl/IInstallAvailablePackageStep.cs | 27 ++ .../TelerikRemovalLibrary/Impl/INullStep.cs | 17 ++ .../Impl/IReplacePortalTabModuleStep.cs | 23 ++ .../Impl/IReplaceTabModuleStep.cs | 27 ++ .../TelerikRemovalLibrary/Impl/IStep.cs | 32 +++ .../TelerikRemovalLibrary/Impl/IStepArray.cs | 19 ++ .../Impl/InstallAvailablePackageStep.cs | 167 ++++++++++++ .../TelerikRemovalLibrary/Impl/NullStep.cs | 25 ++ .../Impl/ReplacePortalTabModuleStep.cs | 90 +++++++ .../Impl/ReplaceTabModuleStep.cs | 93 +++++++ .../TelerikRemovalLibrary/Impl/StepBase.cs | 43 +++ .../Impl/TelerikUninstaller.cs | 162 +++++++++++ .../Properties/AssemblyInfo.cs | 20 ++ .../Modules/TelerikRemovalLibrary/Startup.cs | 36 +++ .../UninstallSummaryItem.cs | 58 ++++ .../TelerikRemovalLibrary/packages.config | 6 + DNN_Platform.sln | 54 ++++ 34 files changed, 2247 insertions(+) create mode 100644 DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx create mode 100644 DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj create mode 100644 DNN Platform/Modules/TelerikRemoval/Properties/AssemblyInfo.cs create mode 100644 DNN Platform/Modules/TelerikRemoval/UserControls/DnnCheckBox.cs create mode 100644 DNN Platform/Modules/TelerikRemoval/UserControls/DnnTextButton.cs create mode 100644 DNN Platform/Modules/TelerikRemoval/View.ascx create mode 100644 DNN Platform/Modules/TelerikRemoval/View.ascx.cs create mode 100644 DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs create mode 100644 DNN Platform/Modules/TelerikRemoval/Web.Debug.config create mode 100644 DNN Platform/Modules/TelerikRemoval/Web.Release.config create mode 100644 DNN Platform/Modules/TelerikRemoval/Web.config create mode 100644 DNN Platform/Modules/TelerikRemoval/module.css create mode 100644 DNN Platform/Modules/TelerikRemoval/packages.config create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/ITelerikUninstaller.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Properties/AssemblyInfo.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/packages.config diff --git a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx new file mode 100644 index 00000000000..83f79fc7250 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + It is not possible to automatically remove Telerik on your installation due to the following extensions: + + + Starting with DNN 10.0.0, it will be mandatory to remove Telerik. Please update or replace the above extensions ASAP and then follow the <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">manual Telerik removal steps</a>. + + + Since your installation does NOT appear to be utilizing any of these components, you should remove them now to improve the security of your application. + + + Security Alert + + + We have detected the presence of the previously distributed Telerik developer components. + + + A Security Bulletin was released in August of 2021 that recommends immediate removal of this component due to the high-level security vulnerabilities present. You can read more about this on the <a href="https://dnncommunity.org/security" target="_blank">DNN Security Center</a>. + + + Ready for Future Upgrades + + + We have confirmed that you have removed Telerik, which makes your site ready for DNN 10.0.0. + + + Please note that selecting "Yes" from below will complete <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">these steps</a> for you automatically. + + + No, Leave my Site Insecure + + + Yes, Improve my Security & Remove Telerik Now + + + Invalid Telerik anti-forgery token. + + + Super User Required + + + This operation requires super-user access level. + + + I confirm I've taken a backup of my website files and database. + + + Telerik Uninstallation Report + + + Remove Telerik Now + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj new file mode 100644 index 00000000000..e443d4633e9 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj @@ -0,0 +1,172 @@ + + + + + Debug + AnyCPU + + + 2.0 + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Dnn.Modules.TelerikRemoval + Dnn.Modules.TelerikRemoval + v4.7.2 + true + + 44388 + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + bin\Dnn.Modules.TelerikRemoval.xml + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + ..\..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + + + + + + + View.ascx + ASPXCodeBehind + + + View.ascx + + + + + stylecop.json + + + + Web.config + + + Web.config + + + + + {6928A9B1-F88A-4581-A132-D3EB38669BB0} + DotNetNuke.Abstractions + + + {0FCA217A-5F9A-4F5B-A31B-86D64AE65198} + DotNetNuke.DependencyInjection + + + {ee1329fe-fd88-4e1a-968c-345e394ef080} + DotNetNuke.Web + + + {6b29aded-7b56-4484-bea5-c0e09079535b} + DotNetNuke.Library + + + {ef55f4c7-ac75-49ef-8f82-b6c8f877a1f7} + Dnn.Modules.TelerikRemovalLibrary + + + + + + + + + Designer + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 50985 + / + https://localhost:44388/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/Properties/AssemblyInfo.cs b/DNN Platform/Modules/TelerikRemoval/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..263961c708f --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dnn.Modules.TelerikRemoval")] +[assembly: AssemblyDescription("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("21acf0f1-2a5f-47d2-a0f4-09c95acf8aba")] diff --git a/DNN Platform/Modules/TelerikRemoval/UserControls/DnnCheckBox.cs b/DNN Platform/Modules/TelerikRemoval/UserControls/DnnCheckBox.cs new file mode 100644 index 00000000000..2580166b2e4 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/UserControls/DnnCheckBox.cs @@ -0,0 +1,83 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemoval.UserControls +{ + using System.Web.UI; + + using DotNetNuke.Web.UI; + + using WrappedDnnCheckBox = DotNetNuke.Web.UI.WebControls.DnnCheckBox; + + /// + /// A wrapper around + /// to support localization. + /// + public class DnnCheckBox : WrappedDnnCheckBox, ILocalizable + { + private bool localize = true; + + /// + public string LocalResourceFile { get; set; } + + /// + public bool Localize + { + get + { + if (this.DesignMode) + { + return false; + } + + return this.localize; + } + + set + { + this.localize = value; + } + } + + /// + public virtual void LocalizeStrings() + { + if (!this.Localize) + { + return; + } + + if (!string.IsNullOrEmpty(this.ToolTip)) + { + this.ToolTip = Utilities.GetLocalizedStringFromParent(this.ToolTip, this); + } + + if (!string.IsNullOrEmpty(this.Text)) + { + var unlocalizedText = this.Text; + this.Text = Utilities.GetLocalizedStringFromParent(unlocalizedText, this); + if (string.IsNullOrEmpty(this.Text)) + { + this.Text = unlocalizedText; + } + + if (string.IsNullOrEmpty(this.ToolTip)) + { + this.ToolTip = Utilities.GetLocalizedStringFromParent(unlocalizedText + ".ToolTip", this); + if (string.IsNullOrEmpty(this.ToolTip)) + { + this.ToolTip = unlocalizedText; + } + } + } + } + + /// + protected override void Render(HtmlTextWriter writer) + { + this.LocalizeStrings(); + base.Render(writer); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemoval/UserControls/DnnTextButton.cs b/DNN Platform/Modules/TelerikRemoval/UserControls/DnnTextButton.cs new file mode 100644 index 00000000000..7fde018fde3 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/UserControls/DnnTextButton.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemoval.UserControls +{ + using System.Web.UI; + + using DotNetNuke.Web.UI.WebControls; + + /// + /// A simple wrapper around to implement . + /// + public class DnnTextButton : DnnButton, ITextControl + { + } +} diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx new file mode 100644 index 00000000000..3bb98a5f95a --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -0,0 +1,98 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="Dnn.Modules.TelerikRemoval.View" %> +<%@ Register Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" TagPrefix="cc1" %> +<%@ Register Assembly="Dnn.Modules.TelerikRemoval" Namespace="Dnn.Modules.TelerikRemoval.UserControls" TagPrefix="cc2" %> + + + +
+ + +

+ SuperUserRequiredHeading +

+

+ SuperUserRequiredInfo +

+
+ +

+ TelerikNotInstalledHeading +

+

+ TelerikNotInstalledInfo +

+
+ +

+ TelerikInstalledHeading +

+

+ TelerikInstalledDetected +

+

+ TelerikInstalledBulletin +

+

+ TelerikInstalledButNotUsedInfo +

+

+ +

+
+ +
+
+ +

+ TelerikInstalledHeading +

+

+ TelerikInstalledDetected +

+

+ TelerikInstalledBulletin +

+

+ TelerikInstalledAndUsedInfo +

+
+ +
+

+ TelerikInstalledAndUsedWarning +

+
+ +

+ UninstallReportHeading +

+

+ +

+
+ + + + + + + + + + + + + + + + + + + +
StepResultNotes
<%# Eval("StepName") %><%# this.ConvertBooleanToIcon(Eval("Success")) %><%# Eval("Notes") %>
+
+
+
+
+
+
diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs new file mode 100644 index 00000000000..8cfe9cfebf1 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -0,0 +1,209 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemoval +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web.UI; + using System.Web.UI.WebControls; + + using Dnn.Modules.TelerikRemovalLibrary; + using DotNetNuke.Common.Internal; + using DotNetNuke.Entities.Modules; + + /// + /// The main view of the DNN Telerik Removal module. + /// + public partial class View : PortalModuleBase + { + private readonly IServiceProvider serviceProvider; + + /// + /// Initializes a new instance of the class. + /// + public View() + { + this.serviceProvider = this.DependencyProvider; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + internal View(IServiceProvider serviceProvider) + { + this.serviceProvider = serviceProvider ?? + throw new ArgumentNullException(nameof(serviceProvider)); + } + + /// + /// Event handler for . + /// + /// The object that raised the event. + /// An that contains the event data. + protected void BackupConfirmationCheckBox_CheckedChanged(object sender, EventArgs e) + { + this.RemoveTelerikButton.Enabled = this.BackupConfirmationCheckBox.Checked; + } + + /// + /// Event handler for the event. + /// + /// The object that raised the event. + /// An that contains the event data. + protected void Page_Load(object sender, EventArgs e) + { + if (!this.Page.IsPostBack) + { + this.InitMainMultiView(); + this.InitRemoveTelerikButton(); + } + } + + /// + /// Click event handler for RemoveTelerikButton. + /// + /// The object that raised the event. + /// An that contains the event data. + protected void RemoveTelerikButton_Click(object sender, EventArgs e) + { + if (!this.BackupConfirmationCheckBox.Checked) + { + return; + } + + var uninstaller = this.GetService(); + + uninstaller.Execute(); + + this.UninstallReportRepeater.DataSource = uninstaller.Progress; + + this.MainMultiView.ActiveViewIndex = 4; // UninstallReportView + + this.DataBind(); + } + + /// + /// Converts a boolean value into a check mark if True, + /// a cross mark if False, or an empty string if null. + /// If the input value is not of Boolean type or Null, + /// the unmodified input value is returned. + /// + /// The input value to convert. + /// + /// The check mark button icon ✅ (&#9989;) if value is True, + /// the cross mark icon ❌ (&#10060;) if value is False, + /// an empty String if value is Null, + /// or the unmodified input value otherwise. + /// + protected string ConvertBooleanToIcon(object value) + { + if (value is null) + { + return string.Empty; + } + + if (typeof(bool) != value.GetType()) + { + return $"{value}"; + } + + return ((bool)value) ? "✅" : "❌"; + } + + private static Table CreateTable(IEnumerable items, int maxRows, int maxColumns) + { + var capacity = maxRows * maxColumns; + + var row = new TableRow(); + var list = StartNewColumn(row); + + foreach (var item in items.Take(capacity - 1)) + { + list.Items.Add(new ListItem(item)); + + if (list.Items.Count == maxRows) + { + list = StartNewColumn(row); + } + } + + if (capacity < items.Count()) + { + list.Items.Add(new ListItem("...")); + } + + foreach (TableCell cell in row.Cells) + { + cell.Width = Unit.Percentage(100.0 / row.Cells.Count); + } + + var table = new Table + { + Rows = { row }, + Width = Unit.Percentage(100.0), + }; + + return table; + } + + private static ListControl StartNewColumn(TableRow row) + { + var list = new BulletedList(); + + var cell = new TableCell + { + Controls = { list }, + VerticalAlign = VerticalAlign.Top, + }; + + row.Cells.Add(cell); + + return list; + } + + private void InitMainMultiView() + { + if (!this.UserInfo.IsSuperUser) + { + this.MainMultiView.ActiveViewIndex = 0; // RegularUserView + return; + } + + var telerikUtils = this.GetService(); + + if (!telerikUtils.TelerikIsInstalled()) + { + this.MainMultiView.ActiveViewIndex = 1; // NotInstalledView + return; + } + + var assemblies = telerikUtils.GetAssembliesThatDependOnTelerik(); + + if (!assemblies.Any()) + { + this.MainMultiView.ActiveViewIndex = 2; // InstalledButNotUsedView + return; + } + + this.MainMultiView.ActiveViewIndex = 3; // InstalledAndUsedView + + var table = CreateTable(assemblies, maxRows: 3, maxColumns: 3); + this.AssemblyListPlaceHolder.Controls.Add(table); + } + + private void InitRemoveTelerikButton() + { + this.RemoveTelerikButton.Enabled = false; + } + + private T GetService() + where T : class + { + return (T)this.serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs new file mode 100644 index 00000000000..a2f9e37a3b6 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs @@ -0,0 +1,251 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Dnn.Modules.TelerikRemoval +{ + + + public partial class View + { + + /// + /// MainUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel MainUpdatePanel; + + /// + /// MainMultiView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.MultiView MainMultiView; + + /// + /// RegularUserView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.View RegularUserView; + + /// + /// SuperUserRequiredHeadingLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel SuperUserRequiredHeadingLabel; + + /// + /// SuperUserRequiredInfoLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel SuperUserRequiredInfoLabel; + + /// + /// NotInstalledView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.View NotInstalledView; + + /// + /// TelerikNotInstalledHeadingLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikNotInstalledHeadingLabel; + + /// + /// TelerikNotInstalledInfoLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikNotInstalledInfoLabel; + + /// + /// InstalledButNotUsedView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.View InstalledButNotUsedView; + + /// + /// TelerikInstalledButNotUsedHeadingLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedHeadingLabel; + + /// + /// TelerikInstalledButNotUsedDetectedLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedDetectedLabel; + + /// + /// TelerikInstalledButNotUsedBulletinLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedBulletinLabel; + + /// + /// TelerikInstalledButNotUsedInfoLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedInfoLabel; + + /// + /// BackupConfirmationCheckBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnCheckBox BackupConfirmationCheckBox; + + /// + /// RemoveTelerikButton control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnTextButton RemoveTelerikButton; + + /// + /// InstalledAndUsedView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.View InstalledAndUsedView; + + /// + /// TelerikInstalledAndUsedHeadingLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedHeadingLabel; + + /// + /// TelerikInstalledAndUsedDetectedLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedDetectedLabel; + + /// + /// TelerikInstalledAndUsedBulletinLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedBulletinLabel; + + /// + /// TelerikInstalledAndUsedInfoLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedInfoLabel; + + /// + /// AssemblyListPlaceHolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder AssemblyListPlaceHolder; + + /// + /// TelerikInstalledAndUsedWarningLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedWarningLabel; + + /// + /// UninstallReportView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.View UninstallReportView; + + /// + /// UninstallReportHeadingLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportHeadingLabel; + + /// + /// UninstallReportDetailLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportDetailLabel; + + /// + /// UninstallReportRepeater control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater UninstallReportRepeater; + } +} diff --git a/DNN Platform/Modules/TelerikRemoval/Web.Debug.config b/DNN Platform/Modules/TelerikRemoval/Web.Debug.config new file mode 100644 index 00000000000..fae9cfefa97 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/Web.Release.config b/DNN Platform/Modules/TelerikRemoval/Web.Release.config new file mode 100644 index 00000000000..da6e960b8d1 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/Web.config b/DNN Platform/Modules/TelerikRemoval/Web.config new file mode 100644 index 00000000000..eb1022d506b --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Web.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/module.css b/DNN Platform/Modules/TelerikRemoval/module.css new file mode 100644 index 00000000000..54c50011b96 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/module.css @@ -0,0 +1,21 @@ +#telerikRemoval input[type=checkbox] { + margin-right: 12px; +} + +#telerikRemoval table { + width: 100%; +} + +#telerikRemoval td, #telerikRemoval th { + padding: 12px; + border-top: 1px solid lightgray; + border-bottom: 1px solid lightgray; +} + +#uninstallReport th { + font-size: initial; +} + +#telerikRemoval td:nth-child(2), #telerikRemoval th:nth-child(2) { + text-align: center; +} diff --git a/DNN Platform/Modules/TelerikRemoval/packages.config b/DNN Platform/Modules/TelerikRemoval/packages.config new file mode 100644 index 00000000000..a78dbbc47c8 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj new file mode 100644 index 00000000000..3ebe03a1cb8 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -0,0 +1,101 @@ + + + + + Debug + AnyCPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7} + Library + Properties + Dnn.Modules.TelerikRemovalLibrary + Dnn.Modules.TelerikRemovalLibrary + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Dnn.Modules.TelerikRemovalLibrary.xml + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\Microsoft.Extensions.DependencyInjection.2.1.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll + + + ..\..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stylecop.json + + + + + + + + + + + + {6928A9B1-F88A-4581-A132-D3EB38669BB0} + DotNetNuke.Abstractions + + + {0FCA217A-5F9A-4F5B-A31B-86D64AE65198} + DotNetNuke.DependencyInjection + + + {3CD5F6B8-8360-4862-80B6-F402892DB7DD} + DotNetNuke.Instrumentation + + + {6B29ADED-7B56-4484-BEA5-C0E09079535B} + DotNetNuke.Library + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/ITelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/ITelerikUninstaller.cs new file mode 100644 index 00000000000..eb2740908f4 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/ITelerikUninstaller.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System.Collections.Generic; + + /// + /// Handles Telerik uninstall process. + /// + public interface ITelerikUninstaller + { + /// + /// Gets an of type + /// containing the overall execution progress. + /// + IEnumerable Progress { get; } + + /// + /// Executes the Telerik uninstall process. + /// + void Execute(); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs new file mode 100644 index 00000000000..ebc43293889 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Collections.Generic; + using System.IO; + + using DotNetNuke.Common; + + /// + /// Abstraction on file system utilities to enable unit testing. + /// + internal class FileSystemProvider : IFileSystemProvider + { + /// + public Stream CreateFileStream(string path, FileMode mode, FileAccess access) + { + return new FileStream(path, mode, access); + } + + /// + public void DeleteFile(string path) + { + File.Delete(path); + } + + /// + public void DeleteFolderRecursive(string path) + { + Globals.DeleteFolderRecursive(path); + } + + /// + public bool DirectoryExists(string path) => Directory.Exists(path); + + /// + public IEnumerable EnumerateFiles(string path, string searchPattern, SearchOption searchOption) => + Directory.EnumerateFiles(path, searchPattern, searchOption); + + /// + public bool FileExists(string path) => File.Exists(path); + + /// + public void SetFileAttributes(string path, FileAttributes fileAttributes) + { + File.SetAttributes(path, fileAttributes); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs new file mode 100644 index 00000000000..0aa101f0547 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Collections.Generic; + using System.IO; + + using DotNetNuke.Common.Utilities; + + /// + /// Abstraction on file system utilities to enable unit testing. + /// + internal interface IFileSystemProvider + { + /// + Stream CreateFileStream(string path, FileMode mode, FileAccess access); + + /// + void DeleteFile(string path); + + /// + void DeleteFolderRecursive(string path); + + /// + bool DirectoryExists(string path); + + /// + IEnumerable EnumerateFiles(string path, string searchPattern, SearchOption searchOption); + + /// + bool FileExists(string path); + + /// + void SetFileAttributes(string path, FileAttributes fileAttributes); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs new file mode 100644 index 00000000000..c42342d1a15 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// Step to install packages. + /// + internal interface IInstallAvailablePackageStep : IStep + { + /// + /// Gets or sets the package file name pattern. + /// + string PackageFileNamePattern { get; set; } + + /// + /// Gets or sets the package name. + /// + string PackageName { get; set; } + + /// + /// Gets or sets the package type. + /// + string PackageType { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs new file mode 100644 index 00000000000..a1f3786f0f2 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// A placeholder step. + /// + internal interface INullStep : IStep + { + /// + /// Gets or sets the internal step name. + /// + string InternalName { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs new file mode 100644 index 00000000000..8f9ff21e244 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// Replaces a given module in a page with another module, for a specific portal. + /// + internal interface IReplacePortalTabModuleStep : IStep + { + /// + /// Gets or sets the parent instance, + /// which provides information of page name, old module name and new module name. + /// + IReplaceTabModuleStep ParentStep { get; set; } + + /// + /// Gets or sets the Portal Id. + /// + int PortalId { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs new file mode 100644 index 00000000000..62a865682bd --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// Replaces a given module in a page with another module. + /// + internal interface IReplaceTabModuleStep : IStep + { + /// + /// Gets or sets the page name. + /// + string PageName { get; set; } + + /// + /// Gets or sets the name of the module to replace. + /// + string OldModuleName { get; set; } + + /// + /// Gets or sets the name of the module that will replace the old module. + /// + string NewModuleName { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs new file mode 100644 index 00000000000..fb69daa42b7 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// An interface that represent a process step that can be executed. + /// + internal interface IStep + { + /// + /// Gets the step name. + /// + string Name { get; } + + /// + /// Gets the remarks collected during step execution. + /// + string Notes { get; } + + /// + /// Gets a value indicating whether the step succeeded, failed or was not executed. + /// + bool? Success { get; } + + /// + /// Executes the step. + /// + void Execute(); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs new file mode 100644 index 00000000000..fa21e673688 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Collections.Generic; + + /// + /// An interface that represent an abstract process step that contains a set of nested steps. + /// + internal interface IStepArray : IStep + { + /// + /// Gets an of instances contained in this array step. + /// + IEnumerable Steps { get; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs new file mode 100644 index 00000000000..1a62de6df59 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs @@ -0,0 +1,167 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + using System.IO; + using System.Linq; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Common.Utilities; + using DotNetNuke.Services.Installer; + using DotNetNuke.Services.Installer.Packages; + + /// + internal class InstallAvailablePackageStep : StepBase, IInstallAvailablePackageStep + { + private readonly IApplicationStatusInfo appStatusInfo; + private readonly IFileSystemProvider fsProvider; + private readonly IPackageController packageController; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + /// An instance of . + public InstallAvailablePackageStep( + IApplicationStatusInfo appStatusInfo, + IFileSystemProvider fsProvider, + IPackageController packageController) + { + this.appStatusInfo = appStatusInfo ?? + throw new ArgumentNullException(nameof(appStatusInfo)); + + this.fsProvider = fsProvider ?? + throw new ArgumentNullException(nameof(fsProvider)); + + this.packageController = packageController ?? + throw new ArgumentNullException(nameof(packageController)); + } + + /// + public override string Name => $"Install package '{this.PackageName}'"; + + /// + public string PackageFileNamePattern { get; set; } + + /// + public string PackageName { get; set; } + + /// + public string PackageType { get; set; } + + /// + protected override void ExecuteInternal() + { + if (this.PackageName is null) + { + throw new ArgumentNullException(nameof(this.PackageName)); + } + + if (this.PackageFileNamePattern is null) + { + throw new ArgumentNullException(nameof(this.PackageFileNamePattern)); + } + + if (this.PackageType is null) + { + throw new ArgumentNullException(nameof(this.PackageType)); + } + + if (this.PackageIsAlreadyInstalled()) + { + this.Success = true; + this.Notes = $"Package '{this.PackageName}' was already installed."; + return; + } + + var availableFiles = this.fsProvider.EnumerateFiles( + Path.Combine(this.appStatusInfo.ApplicationMapPath, "Install", this.PackageType), + this.PackageFileNamePattern, + SearchOption.TopDirectoryOnly); + + var filePath = availableFiles + .OrderByDescending(path => path) + .FirstOrDefault(); + + if (filePath is null) + { + this.Success = false; + this.Notes = $"Package file '{this.PackageFileNamePattern}' was not found."; + return; + } + + using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) + { + var installer = new Installer( + stream, + this.appStatusInfo.ApplicationMapPath, + loadManifest: false, + deleteTemp: false); + + try + { + installer.InstallerInfo.PortalID = Null.NullInteger; + + if (installer.InstallerInfo.ManifestFile != null) + { + installer.ReadManifest(true); + } + + installer.InstallerInfo.Log.Logs.Clear(); + installer.InstallerInfo.IgnoreWhiteList = true; + installer.InstallerInfo.RepairInstall = true; + + installer.Install(); + + if (!installer.IsValid) + { + this.Success = false; + this.Notes = string.Join(Environment.NewLine, installer.InstallerInfo.Log.Logs); + } + else + { + this.DeleteInstallFile(filePath); + + this.Success = true; + } + } + finally + { + this.DeleteTempInstallFiles(installer); + } + } + } + + private void DeleteInstallFile(string installerFile) + { + if (this.fsProvider.FileExists(installerFile)) + { + this.fsProvider.SetFileAttributes(installerFile, FileAttributes.Normal); + this.fsProvider.DeleteFile(installerFile); + } + } + + private void DeleteTempInstallFiles(Installer installer) + { + var tempFolder = installer.TempInstallFolder; + + if (!string.IsNullOrEmpty(tempFolder) && this.fsProvider.DirectoryExists(tempFolder)) + { + this.fsProvider.DeleteFolderRecursive(tempFolder); + } + } + + private bool PackageIsAlreadyInstalled() + { + Func predicate = p => + "Module".Equals(p.PackageType, StringComparison.OrdinalIgnoreCase) && + this.PackageName.Equals(p.Name, StringComparison.OrdinalIgnoreCase); + + return this.packageController.GetExtensionPackages(Null.NullInteger, predicate).Any(); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs new file mode 100644 index 00000000000..7240abcdd4d --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + internal class NullStep : StepBase, INullStep + { + /// + public override string Name => this.InternalName; + + /// + /// Gets or sets the step's internal name. + /// + public string InternalName { get; set; } + + /// + protected override void ExecuteInternal() + { + this.Success = false; + this.Notes = "Not yet implemented."; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs new file mode 100644 index 00000000000..2b5a17df92a --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs @@ -0,0 +1,90 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + using System.Linq; + + using DotNetNuke.Entities.Modules; + using DotNetNuke.Entities.Tabs; + + /// + internal class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleStep + { + private readonly IModuleController moduleController; + private readonly ITabController tabController; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public ReplacePortalTabModuleStep(IModuleController moduleController, ITabController tabController) + { + this.moduleController = moduleController ?? + throw new ArgumentNullException(nameof(moduleController)); + + this.tabController = tabController ?? + throw new ArgumentNullException(nameof(tabController)); + } + + /// + public override string Name => string.Format( + "Replace '{0}' with '{1}' in page '{2}', portal ID '{3}'", + this.OldModuleName, + this.NewModuleName, + this.PageName, + this.PortalId); + + /// + public IReplaceTabModuleStep ParentStep { get; set; } + + /// + public int PortalId { get; set; } + + private string OldModuleName => this.ParentStep?.OldModuleName; + + private string NewModuleName => this.ParentStep?.NewModuleName; + + private string PageName => this.ParentStep?.PageName; + + /// + protected override void ExecuteInternal() + { + if (this.ParentStep == null) + { + throw new InvalidOperationException("Parent step not set."); + } + + var tab = this.tabController.GetTabByName(this.PageName, this.PortalId); + + if (tab is null) + { + this.Success = true; + this.Notes = $"Page '{this.PageName}' not found in portal '{this.PortalId}'."; + return; + } + + var modules = tab.Modules + .Cast() + .Where(m => this.OldModuleName.Equals(m.ModuleDefinition.DefinitionName, StringComparison.OrdinalIgnoreCase)); + + if (!modules.Any()) + { + this.Success = true; + this.Notes = $"'{this.OldModuleName}' module not found in '{this.PageName}' page."; + } + + foreach (var module in modules) + { + this.moduleController.DeleteTabModule(tab.TabID, module.KeyID, false); + } + + this.moduleController.ClearCache(tab.TabID); + + this.Success = true; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs new file mode 100644 index 00000000000..28b58e6e896 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs @@ -0,0 +1,93 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using DotNetNuke.Abstractions.Portals; + using DotNetNuke.Entities.Portals; + + /// + internal partial class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, IStepArray + { + private readonly IServiceProvider serviceProvider; + private readonly IList steps; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public ReplaceTabModuleStep(IServiceProvider serviceProvider) + { + this.serviceProvider = serviceProvider ?? + throw new ArgumentNullException(nameof(serviceProvider)); + + this.steps = new List(); + } + + /// + public override string Name => string.Format( + "Replace '{0}' with '{1}' in page '{2}'", + this.OldModuleName, + this.NewModuleName, + this.PageName); + + /// + public string PageName { get; set; } + + /// + public string OldModuleName { get; set; } + + /// + public string NewModuleName { get; set; } + + /// + public IEnumerable Steps => this.steps; + + /// + protected override void ExecuteInternal() + { + if (this.PageName is null) + { + throw new InvalidOperationException("Page name not set."); + } + + if (this.OldModuleName is null) + { + throw new InvalidOperationException("Old module name not set."); + } + + if (this.NewModuleName is null) + { + throw new InvalidOperationException("New module name not set."); + } + + var portalController = this.GetService(); + + var steps = portalController.GetPortals() + .Cast() + .Select(info => + { + var step = this.GetService(); + step.ParentStep = this; + return step; + }); + + foreach (var step in steps) + { + this.steps.Add(step); + step.Execute(); + } + } + + private T GetService() + where T : class + { + return (T)this.serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs new file mode 100644 index 00000000000..b8f914819c0 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + + /// + /// A base class that implements . + /// + internal abstract class StepBase : IStep + { + /// + public abstract string Name { get; } + + /// + public bool? Success { get; protected set; } + + /// + public string Notes { get; protected set; } + + /// + public void Execute() + { + try + { + this.ExecuteInternal(); + } + catch + { + // this.log.Error(ex); + this.Success = false; + this.Notes = "Internal error."; + } + } + + /// + /// Performs the actual step execution. + /// + protected abstract void ExecuteInternal(); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs new file mode 100644 index 00000000000..720fb3bdf79 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + using System.Collections.Generic; + using DotNetNuke.Common.Utilities; + using DotNetNuke.Instrumentation; + + /// + internal class TelerikUninstaller : ITelerikUninstaller + { + private readonly ILog log; + private readonly IServiceProvider serviceProvider; + private readonly List progress; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public TelerikUninstaller(IServiceProvider serviceProvider) + { + this.serviceProvider = serviceProvider ?? + throw new ArgumentNullException(nameof(serviceProvider)); + + this.log = this.GetService().GetLogger(typeof(TelerikUninstaller)); + + this.progress = new List(); + } + + /// + public IEnumerable Progress => this.progress; + + /// + public void Execute() + { + var steps = new[] + { + this.InstallAvailableExtension( + "ResourceManager", + "DNNCE_ResourceManager_09.*_Install.resources", + "Module"), + this.ReplaceModuleInPage("File Management", "Digital Asset Management", "ResourceManager"), + this.ReplaceModuleInHostPage("File Management", "Digital Asset Management", "ResourceManager"), + this.RemoveSystemAttributeFromPackage("DigitalAssetsManagement"), + this.RemoveSystemAttributeFromPackage("DotNetNuke.Telerik.Web"), + this.RemoveSystemAttributeFromPackage("DotNetNuke.Web.Deprecated"), + this.RemoveSystemAttributeFromPackage("DotNetNuke.Website.Deprecated"), + this.RemoveSystemAttributeFromPackage("Admin.Messaging"), + this.ClearCache(), + this.UninstallExtension("Digital Assets Management"), + this.UninstallExtension("Messaging"), + this.UninstallExtension("DotNetNuke Telerik Web Components"), + this.UninstallExtension("DNN Deprecated Web Controls Library"), + this.UninstallExtension("DotNetNuke Deprecated Website Codebehind files"), + this.UninstallExtension("DNN Security HotFix 2017.1"), + this.UninstallExtension("RadEditor Manager"), + this.UpdateSiteUrlsConfig(), + this.UpdateWebConfig(), + this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Telerik_*"), + this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Web.Deprecated_*"), + this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Website.Deprecated_*"), + this.RemoveUninstalledExtensionFiles("DNNSecurityHotFix*"), + }; + + var skip = false; + + foreach (var step in steps) + { + if (!skip) + { + step.Execute(); + + var nullable = step.Success; + if (nullable.HasValue && nullable.Value == false) + { + skip = true; + } + } + + this.progress.AddRange(UninstallSummaryItem.FromStep(step)); + } + } + + private IStep InstallAvailableExtension(string packageName, string fileNamePattern, string packageType) + { + var step = this.GetService(); + step.PackageFileNamePattern = fileNamePattern; + step.PackageName = packageName; + step.PackageType = packageType; + return step; + } + + private IStep ReplaceModuleInPage(string pageName, string oldModuleName, string newModuleName) + { + var step = this.GetService(); + step.PageName = pageName; + step.OldModuleName = oldModuleName; + step.NewModuleName = newModuleName; + return step; + } + + private IStep ReplaceModuleInHostPage(string pageName, string oldModuleName, string newModuleName) + { + var parentStep = this.GetService(); + parentStep.PageName = pageName; + parentStep.OldModuleName = oldModuleName; + parentStep.NewModuleName = newModuleName; + + var step = this.GetService(); + step.ParentStep = parentStep; + step.PortalId = Null.NullInteger; + + return step; + } + + private IStep RemoveSystemAttributeFromPackage(string packageName) + { + return this.NullStep($"Remove the 'System' attribute from package '{packageName}'"); + } + + private IStep ClearCache() + { + return this.NullStep("Clear the cache"); + } + + private IStep UninstallExtension(string packageName) + { + return this.NullStep($"Uninstall the '{packageName}' extension"); + } + + private IStep UpdateSiteUrlsConfig() + { + return this.NullStep("Remove all Telerik rewrite rules from the SiteUrls.config file"); + } + + private IStep UpdateWebConfig() + { + return this.NullStep("Remove all Telerik references from the Web.config file"); + } + + private IStep RemoveUninstalledExtensionFiles(string packageName) + { + return this.NullStep($"Remove extension files '{packageName}'"); + } + + private IStep NullStep(string name) + { + var step = this.GetService(); + step.InternalName = name; + return step; + } + + private T GetService() + where T : class + { + return (T)this.serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Properties/AssemblyInfo.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..80b12ad0a25 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dnn.Modules.TelerikRemovalLibrary")] +[assembly: AssemblyDescription("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ef55f4c7-ac75-49ef-8f82-b6c8f877a1f7")] diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs new file mode 100644 index 00000000000..f902a2a0505 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using Dnn.Modules.TelerikRemovalLibrary.Impl; + using DotNetNuke.DependencyInjection; + using DotNetNuke.Entities.Modules; + using DotNetNuke.Entities.Tabs; + using DotNetNuke.Instrumentation; + using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.DependencyInjection; + + /// + public class Startup : IDnnStartup + { + /// + public void ConfigureServices(IServiceCollection services) + { + // core + services.AddTransient(provider => LoggerSource.Instance); + services.AddTransient(provider => ModuleController.Instance); + services.AddTransient(provider => PackageController.Instance); + services.AddTransient(provider => TabController.Instance); + + // local + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs new file mode 100644 index 00000000000..21c902dfea8 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System.Collections.Generic; + using System.Linq; + + using Dnn.Modules.TelerikRemovalLibrary.Impl; + + /// + /// A data transfer object with an uninstallation summary item. + /// + public class UninstallSummaryItem + { + /// + /// Initializes a new instance of the class. + /// + /// The step to summarize. + internal UninstallSummaryItem(IStep step) + { + this.Notes = step.Notes; + this.StepName = step.Name; + this.Success = step.Success; + } + + /// + /// Gets any remarks collected during step execution. + /// + public string Notes { get; private set; } + + /// + /// Gets a value indicating whether the step succeeded, failed or was not executed. + /// + public bool? Success { get; private set; } + + /// + /// Gets the step name. + /// + public string StepName { get; private set; } + + /// + /// Returns an of type + /// containing the summary of the given instance execution. + /// + /// The step to summarize. + /// + /// A with data from the given instance. + /// + internal static IEnumerable FromStep(IStep step) + { + return step is IStepArray stepArray + ? stepArray.Steps.SelectMany(s => FromStep(s)).ToArray() + : new[] { new UninstallSummaryItem(step) }; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/packages.config b/DNN Platform/Modules/TelerikRemovalLibrary/packages.config new file mode 100644 index 00000000000..53ace5f0073 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DNN_Platform.sln b/DNN_Platform.sln index 9cc53523650..a7d0104f97a 100644 --- a/DNN_Platform.sln +++ b/DNN_Platform.sln @@ -571,6 +571,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.Extensions.FileSy DNN Platform\Components\Microsoft.Extensions.FileSystemGlobbing\Microsoft.Extensions.FileSystemGlobbing.dnn = DNN Platform\Components\Microsoft.Extensions.FileSystemGlobbing\Microsoft.Extensions.FileSystemGlobbing.dnn EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dnn.Modules.TelerikRemoval", "DNN Platform\Modules\TelerikRemoval\Dnn.Modules.TelerikRemoval.csproj", "{21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dnn.Modules.TelerikRemovalLibrary", "DNN Platform\Modules\TelerikRemovalLibrary\Dnn.Modules.TelerikRemovalLibrary.csproj", "{EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Cloud_Debug|Any CPU = Cloud_Debug|Any CPU @@ -2083,6 +2087,54 @@ Global {12583A7E-7BEF-4F79-9CEA-3736D28C3241}.Release-Net45|Any CPU.Build.0 = Release|Any CPU {12583A7E-7BEF-4F79-9CEA-3736D28C3241}.Release-Net45|x86.ActiveCfg = Release|Any CPU {12583A7E-7BEF-4F79-9CEA-3736D28C3241}.Release-Net45|x86.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Debug|Any CPU.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Debug|x86.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Debug|x86.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Release|Any CPU.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Release|Any CPU.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Release|x86.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Cloud_Release|x86.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug|x86.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug|x86.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug-Net45|Any CPU.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug-Net45|Any CPU.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug-Net45|x86.ActiveCfg = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Debug-Net45|x86.Build.0 = Debug|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release|Any CPU.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release|x86.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release|x86.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release-Net45|Any CPU.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release-Net45|Any CPU.Build.0 = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release-Net45|x86.ActiveCfg = Release|Any CPU + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA}.Release-Net45|x86.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Debug|Any CPU.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Debug|x86.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Debug|x86.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Release|Any CPU.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Release|Any CPU.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Release|x86.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Cloud_Release|x86.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug|x86.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug-Net45|Any CPU.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug-Net45|Any CPU.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug-Net45|x86.ActiveCfg = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Debug-Net45|x86.Build.0 = Debug|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release|Any CPU.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release|x86.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release|x86.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release-Net45|Any CPU.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release-Net45|Any CPU.Build.0 = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release-Net45|x86.ActiveCfg = Release|Any CPU + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7}.Release-Net45|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2203,6 +2255,8 @@ Global {CBBA26D2-68FF-4FDB-BD9E-17D4C2CE717F} = {A193D0F9-C722-44BD-B209-2AA2F25C9816} {6395573E-D778-4DBE-BD22-A39273DBF0C9} = {A193D0F9-C722-44BD-B209-2AA2F25C9816} {890623E0-F6C8-4011-9FAF-00939601EBE8} = {A193D0F9-C722-44BD-B209-2AA2F25C9816} + {21ACF0F1-2A5F-47D2-A0F4-09C95ACF8ABA} = {FDDC95FE-3341-4AED-A93E-7A5DF85A55C2} + {EF55F4C7-AC75-49EF-8F82-B6C8F877A1F7} = {FDDC95FE-3341-4AED-A93E-7A5DF85A55C2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {46B6A641-57EB-4B19-B199-23E6FC2AB40B} From 1eb895441b1edc08cd4502aa151b7e65ed134141 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 15:52:28 -0300 Subject: [PATCH 02/37] Finished replace module step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 4 + .../Impl/IDesktopModuleController.cs | 17 +++ .../Impl/IModuleDefinitionController.cs | 19 ++++ .../Impl/InternalDesktopModuleController.cs | 21 ++++ .../InternalModuleDefinitionController.cs | 23 ++++ .../Impl/ReplacePortalTabModuleStep.cs | 106 +++++++++++++++++- .../Modules/TelerikRemovalLibrary/Startup.cs | 2 + 7 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 3ebe03a1cb8..a2e89458d9b 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -49,14 +49,18 @@ + + + + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs new file mode 100644 index 00000000000..cf1fe58bebb --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using DotNetNuke.Entities.Modules; + + /// + /// An abstraction of the class to enable DI and unit testing. + /// + internal interface IDesktopModuleController + { + /// + DesktopModuleInfo GetDesktopModuleByModuleName(string moduleName, int portalID); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs new file mode 100644 index 00000000000..437cbfc04d8 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Collections.Generic; + + using DotNetNuke.Entities.Modules.Definitions; + + /// + /// An abstraction of the class to enable DI and unit testing. + /// + internal interface IModuleDefinitionController + { + /// + Dictionary GetModuleDefinitionsByDesktopModuleID(int desktopModuleID); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs new file mode 100644 index 00000000000..70901839087 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using DotNetNuke.Entities.Modules; + + /// + /// A concrete implementation of + /// that relies on the class. + /// + internal class InternalDesktopModuleController : IDesktopModuleController + { + /// + public DesktopModuleInfo GetDesktopModuleByModuleName(string moduleName, int portalID) + { + return DesktopModuleController.GetDesktopModuleByModuleName(moduleName, portalID); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs new file mode 100644 index 00000000000..eccda8e1bc5 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Collections.Generic; + + using DotNetNuke.Entities.Modules.Definitions; + + /// + /// A concrete implementation of the interface + /// that relies on the class. + /// + internal class InternalModuleDefinitionController : IModuleDefinitionController + { + /// + public Dictionary GetModuleDefinitionsByDesktopModuleID(int desktopModuleID) + { + return ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleID); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs index 2b5a17df92a..8c04982e575 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs @@ -7,6 +7,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary.Impl using System; using System.Linq; + using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Tabs; @@ -15,19 +16,33 @@ internal class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleSte { private readonly IModuleController moduleController; private readonly ITabController tabController; + private readonly IDesktopModuleController desktopModuleController; + private readonly IModuleDefinitionController moduleDefinitionController; /// /// Initializes a new instance of the class. /// /// An instance of . /// An instance of . - public ReplacePortalTabModuleStep(IModuleController moduleController, ITabController tabController) + /// An instance of . + /// An instance of . + public ReplacePortalTabModuleStep( + IModuleController moduleController, + ITabController tabController, + IDesktopModuleController desktopModuleController, + IModuleDefinitionController moduleDefinitionController) { this.moduleController = moduleController ?? throw new ArgumentNullException(nameof(moduleController)); this.tabController = tabController ?? throw new ArgumentNullException(nameof(tabController)); + + this.desktopModuleController = desktopModuleController ?? + throw new ArgumentNullException(nameof(desktopModuleController)); + + this.moduleDefinitionController = moduleDefinitionController ?? + throw new ArgumentNullException(nameof(moduleDefinitionController)); } /// @@ -79,12 +94,95 @@ protected override void ExecuteInternal() foreach (var module in modules) { - this.moduleController.DeleteTabModule(tab.TabID, module.KeyID, false); + this.DeleteTheOldModule(module); + this.AddTheNewModule(module); } - this.moduleController.ClearCache(tab.TabID); - this.Success = true; } + + private static ModuleInfo CloneModule(ModuleInfo module) + { + return new ModuleInfo + { + Alignment = module.Alignment, + AllModules = module.AllModules, + AllTabs = module.AllTabs, + Border = module.Border, + CacheMethod = module.CacheMethod, + CacheTime = module.CacheTime, + Color = module.Color, + ContainerPath = module.ContainerPath, + ContainerSrc = module.ContainerSrc, + CultureCode = module.CultureCode, + DesktopModuleID = module.DesktopModuleID, + DisplayPrint = module.DisplayPrint, + DisplaySyndicate = module.DisplaySyndicate, + DisplayTitle = module.DisplayTitle, + EndDate = module.EndDate, + Footer = module.Footer, + Header = module.Header, + IconFile = module.IconFile, + IsDefaultModule = module.IsDefaultModule, + IsDeleted = module.IsDeleted, + IsShareable = module.IsShareable, + IsShareableViewOnly = module.IsShareableViewOnly, + ModuleControlId = Null.NullInteger, + OwnerPortalID = module.OwnerPortalID, + PaneModuleCount = 0, + PaneModuleIndex = 0, + PaneName = module.PaneName, + PortalID = module.PortalID, + StartDate = module.StartDate, + TabID = module.TabID, + Visibility = module.Visibility, + }; + } + + private int AddTheNewModule(ModuleInfo oldModule) + { + var tabModuleId = Null.NullInteger; + + var desktopModule = this.desktopModuleController.GetDesktopModuleByModuleName( + this.NewModuleName, + oldModule.PortalID); + + var position = oldModule.ModuleOrder; + var permissionType = oldModule.InheritViewPermissions ? 0 : 1; + + var definitions = this.moduleDefinitionController + .GetModuleDefinitionsByDesktopModuleID(desktopModule.DesktopModuleID) + .Values; + + foreach (var definition in definitions) + { + var newModule = CloneModule(oldModule); + + newModule.DesktopModuleID = desktopModule.DesktopModuleID; + newModule.ModuleDefID = definition.ModuleDefID; + newModule.ModuleOrder = position; + newModule.ModuleTitle = definition.FriendlyName; + + this.moduleController.InitialModulePermission(newModule, newModule.TabID, permissionType); + this.moduleController.AddModule(newModule); + + if (tabModuleId == Null.NullInteger) + { + tabModuleId = newModule.ModuleID; + } + + position = this.moduleController.GetTabModule(newModule.TabModuleID).ModuleOrder + 1; + } + + this.moduleController.ClearCache(oldModule.TabID); + + return tabModuleId; + } + + private void DeleteTheOldModule(ModuleInfo module) + { + this.moduleController.DeleteTabModule(module.TabID, module.KeyID, softDelete: false); + this.moduleController.ClearCache(module.TabID); + } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index f902a2a0505..91c03bd05af 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -25,6 +25,8 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(provider => TabController.Instance); // local + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); From fe2cb1a9bf15b71f7f196b533dbcf791d74c2f67 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 10:22:13 -0300 Subject: [PATCH 03/37] Activated All Rules code analysis --- .../Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj | 5 +++++ .../Dnn.Modules.TelerikRemovalLibrary.csproj | 5 +++++ .../Impl/InstallAvailablePackageStep.cs | 4 ++-- .../Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj index e443d4633e9..65667949bec 100644 --- a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj +++ b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj @@ -33,14 +33,19 @@ prompt 4 bin\Dnn.Modules.TelerikRemoval.xml + AllRules.ruleset + true true pdbonly true bin\ + bin\Dnn.Modules.TelerikRemoval.xml TRACE prompt + AllRules.ruleset + true 4 diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index a2e89458d9b..e1eaf9dd55d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -22,6 +22,8 @@ prompt 4 bin\Debug\Dnn.Modules.TelerikRemovalLibrary.xml + AllRules.ruleset + true pdbonly @@ -30,6 +32,9 @@ TRACE prompt 4 + AllRules.ruleset + true + bin\Release\Dnn.Modules.TelerikRemovalLibrary.xml diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs index 1a62de6df59..2ae5f7d29e0 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs @@ -157,11 +157,11 @@ private void DeleteTempInstallFiles(Installer installer) private bool PackageIsAlreadyInstalled() { - Func predicate = p => + bool WithMatchingPackageName(PackageInfo p) => "Module".Equals(p.PackageType, StringComparison.OrdinalIgnoreCase) && this.PackageName.Equals(p.Name, StringComparison.OrdinalIgnoreCase); - return this.packageController.GetExtensionPackages(Null.NullInteger, predicate).Any(); + return this.packageController.GetExtensionPackages(Null.NullInteger, WithMatchingPackageName).Any(); } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs index 720fb3bdf79..83c06699b67 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs @@ -6,6 +6,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary.Impl { using System; using System.Collections.Generic; + using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; From 4fbc673bf88b4aa72eae0aef67567da28fc85039 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 10:33:43 -0300 Subject: [PATCH 04/37] Added packaging support files --- .../Dnn.Modules.TelerikRemoval.csproj | 25 ++----- .../Modules/TelerikRemoval/License.txt | 22 ++++++ .../Modules/TelerikRemoval/Module.build | 22 ++++++ .../Modules/TelerikRemoval/ReleaseNotes.txt | 1 + .../Modules/TelerikRemoval/TelerikRemoval.dnn | 68 +++++++++++++++++++ .../Modules/TelerikRemoval/Web.Debug.config | 30 -------- .../Modules/TelerikRemoval/Web.Release.config | 31 --------- 7 files changed, 120 insertions(+), 79 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemoval/License.txt create mode 100644 DNN Platform/Modules/TelerikRemoval/Module.build create mode 100644 DNN Platform/Modules/TelerikRemoval/ReleaseNotes.txt create mode 100644 DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn delete mode 100644 DNN Platform/Modules/TelerikRemoval/Web.Debug.config delete mode 100644 DNN Platform/Modules/TelerikRemoval/Web.Release.config diff --git a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj index 65667949bec..f9b348f9e7c 100644 --- a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj +++ b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj @@ -16,7 +16,7 @@ v4.7.2 true - 44388 + @@ -73,7 +73,9 @@ + + @@ -93,7 +95,9 @@ stylecop.json + + Web.config @@ -139,20 +143,12 @@ + - True - True - 50985 - / - https://localhost:44388/ - False - False - - - False + True @@ -167,11 +163,4 @@ - \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/License.txt b/DNN Platform/Modules/TelerikRemoval/License.txt new file mode 100644 index 00000000000..82b0ac4187f --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/License.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors +All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DNN Platform/Modules/TelerikRemoval/Module.build b/DNN Platform/Modules/TelerikRemoval/Module.build new file mode 100644 index 00000000000..c79596fbcd3 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/Module.build @@ -0,0 +1,22 @@ + + + + $(MSBuildProjectDirectory)\..\..\.. + + + + resources + TelerikRemoval + DNNCE_TelerikRemoval + $(WebsitePath)\DesktopModules\TelerikRemoval + $(WebsiteInstallPath)\Module + + + + + + + + + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/ReleaseNotes.txt b/DNN Platform/Modules/TelerikRemoval/ReleaseNotes.txt new file mode 100644 index 00000000000..c328c3ddc6c --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/ReleaseNotes.txt @@ -0,0 +1 @@ +

Please see https://www.github.com/dnnsoftware for the complete release history.

\ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn new file mode 100644 index 00000000000..38615beb9cd --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn @@ -0,0 +1,68 @@ + + + + Telerik Removal + + This module allows you to remove the DotNetNuke Telerik Web Components library from your site. + + + .NET Foundation and Contributors + DNN Community + https://dnncommunity.org + info@dnncommunity.org + + + + + 09.08.00 + + + + + DesktopModules/TelerikRemoval + + Resources.zip + + + + + + TelerikRemoval + TelerikRemoval + + + + Telerik Removal + 0 + + + + DesktopModules/TelerikRemoval/View.ascx + False + + View + + https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html + 0 + + + + + + + + + + Dnn.Modules.TelerikRemoval.dll + bin + + + Dnn.Modules.TelerikRemovalLibrary.dll + bin + + + + + + + diff --git a/DNN Platform/Modules/TelerikRemoval/Web.Debug.config b/DNN Platform/Modules/TelerikRemoval/Web.Debug.config deleted file mode 100644 index fae9cfefa97..00000000000 --- a/DNN Platform/Modules/TelerikRemoval/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/Web.Release.config b/DNN Platform/Modules/TelerikRemoval/Web.Release.config deleted file mode 100644 index da6e960b8d1..00000000000 --- a/DNN Platform/Modules/TelerikRemoval/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file From 86bd0d19f72b3488a951e83d50ad547fe8c00fc8 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 17:47:50 -0300 Subject: [PATCH 05/37] Implemented SQL step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 4 ++ .../Impl/ExecuteSqlStep.cs | 49 +++++++++++++++++++ .../Impl/IDataProvider.cs | 23 +++++++++ .../Impl/IExecuteSqlStep.cs | 29 +++++++++++ .../Impl/InternalDataProvider.cs | 23 +++++++++ .../Impl/TelerikUninstaller.cs | 12 ++++- .../Modules/TelerikRemovalLibrary/Startup.cs | 2 + 7 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index e1eaf9dd55d..77682d1525b 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -53,8 +53,11 @@
+ + + @@ -64,6 +67,7 @@ + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs new file mode 100644 index 00000000000..73652884ee9 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + using System.Data; + + /// + internal class ExecuteSqlStep : StepBase, IExecuteSqlStep + { + private readonly IDataProvider dataProvider; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public ExecuteSqlStep(IDataProvider dataProvider) + { + this.dataProvider = dataProvider ?? + throw new ArgumentNullException(nameof(dataProvider)); + } + + /// + public string CommandText { get; set; } + + /// + public string InternalName { get; set; } + + /// + public override string Name => this.InternalName; + + /// + public IDataReader Result { get; private set; } + + /// + protected override void ExecuteInternal() + { + if (this.CommandText is null) + { + throw new ArgumentNullException(nameof(this.CommandText)); + } + + this.Result = this.dataProvider.ExecuteSQL(this.CommandText); + this.Success = true; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs new file mode 100644 index 00000000000..be9326d3b03 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Data; + + using DotNetNuke.Data; + + /// + /// An abstraction of the class to enable DI and unit testing. + /// + internal interface IDataProvider + { + /// + /// Executes a SQL command. + /// + /// The SQL command to execute. + /// A with the results of the command execution. + IDataReader ExecuteSQL(string sql); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs new file mode 100644 index 00000000000..b8dab231087 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Data; + + /// + /// Enables arbitrary SQL execution. + /// + internal interface IExecuteSqlStep : IStep + { + /// + /// Gets or sets the SQL command to execute. + /// + string CommandText { get; set; } + + /// + /// Gets or sets the step's internal name. + /// + string InternalName { get; set; } + + /// + /// Gets an instance of with the results of the command execution. + /// + IDataReader Result { get; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs new file mode 100644 index 00000000000..e1c9e15ebd2 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System.Data; + + using DotNetNuke.Data; + + /// + /// An implementation of + /// that relies on the class. + /// + internal class InternalDataProvider : IDataProvider + { + /// + public IDataReader ExecuteSQL(string sql) + { + return DataProvider.Instance().ExecuteSQL(sql); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs index 83c06699b67..7c9b58ae07d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs @@ -119,7 +119,17 @@ private IStep ReplaceModuleInHostPage(string pageName, string oldModuleName, str private IStep RemoveSystemAttributeFromPackage(string packageName) { - return this.NullStep($"Remove the 'System' attribute from package '{packageName}'"); + var commandFormat = string.Join( + Environment.NewLine, + "UPDATE {{databaseOwner}}{{objectQualifier}}Packages", + "SET IsSystemPackage = 0", + "WHERE [Name] = '{0}'"); + + var step = this.GetService(); + step.InternalName = $"Remove the 'System' attribute from package '{packageName}'"; + step.CommandText = string.Format(commandFormat, packageName); + + return step; } private IStep ClearCache() diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 91c03bd05af..33700007e65 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -25,7 +25,9 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(provider => TabController.Instance); // local + services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); From b8d83c31357f40b07b5f7bac8b4ee0a9dd769018 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 18:37:57 -0300 Subject: [PATCH 06/37] Added Required attribute to validate step properties --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 1 + .../Impl/ExecuteSqlStep.cs | 6 +----- .../Impl/InstallAvailablePackageStep.cs | 18 +++--------------- .../Impl/ReplacePortalTabModuleStep.cs | 7 ++----- .../Impl/ReplaceTabModuleStep.cs | 18 +++--------------- .../Impl/RequiredAttribute.cs | 17 +++++++++++++++++ .../TelerikRemovalLibrary/Impl/StepBase.cs | 18 ++++++++++++++++++ 7 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 77682d1525b..50cde0887e1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -73,6 +73,7 @@ + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs index 73652884ee9..aff9153cc48 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs @@ -23,6 +23,7 @@ public ExecuteSqlStep(IDataProvider dataProvider) } /// + [Required] public string CommandText { get; set; } /// @@ -37,11 +38,6 @@ public ExecuteSqlStep(IDataProvider dataProvider) /// protected override void ExecuteInternal() { - if (this.CommandText is null) - { - throw new ArgumentNullException(nameof(this.CommandText)); - } - this.Result = this.dataProvider.ExecuteSQL(this.CommandText); this.Success = true; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs index 2ae5f7d29e0..9554070aed5 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs @@ -45,32 +45,20 @@ public InstallAvailablePackageStep( public override string Name => $"Install package '{this.PackageName}'"; /// + [Required] public string PackageFileNamePattern { get; set; } /// + [Required] public string PackageName { get; set; } /// + [Required] public string PackageType { get; set; } /// protected override void ExecuteInternal() { - if (this.PackageName is null) - { - throw new ArgumentNullException(nameof(this.PackageName)); - } - - if (this.PackageFileNamePattern is null) - { - throw new ArgumentNullException(nameof(this.PackageFileNamePattern)); - } - - if (this.PackageType is null) - { - throw new ArgumentNullException(nameof(this.PackageType)); - } - if (this.PackageIsAlreadyInstalled()) { this.Success = true; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs index 8c04982e575..c603dd312f1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs @@ -54,9 +54,11 @@ public ReplacePortalTabModuleStep( this.PortalId); /// + [Required] public IReplaceTabModuleStep ParentStep { get; set; } /// + [Required] public int PortalId { get; set; } private string OldModuleName => this.ParentStep?.OldModuleName; @@ -68,11 +70,6 @@ public ReplacePortalTabModuleStep( /// protected override void ExecuteInternal() { - if (this.ParentStep == null) - { - throw new InvalidOperationException("Parent step not set."); - } - var tab = this.tabController.GetTabByName(this.PageName, this.PortalId); if (tab is null) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs index 28b58e6e896..ea9db4a36a2 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs @@ -37,12 +37,15 @@ public ReplaceTabModuleStep(IServiceProvider serviceProvider) this.PageName); /// + [Required] public string PageName { get; set; } /// + [Required] public string OldModuleName { get; set; } /// + [Required] public string NewModuleName { get; set; } /// @@ -51,21 +54,6 @@ public ReplaceTabModuleStep(IServiceProvider serviceProvider) /// protected override void ExecuteInternal() { - if (this.PageName is null) - { - throw new InvalidOperationException("Page name not set."); - } - - if (this.OldModuleName is null) - { - throw new InvalidOperationException("Old module name not set."); - } - - if (this.NewModuleName is null) - { - throw new InvalidOperationException("New module name not set."); - } - var portalController = this.GetService(); var steps = portalController.GetPortals() diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs new file mode 100644 index 00000000000..ef1cff766cb --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using System; + + /// + /// This class defines the attribute that sets a property to be a required property. + /// A step execution fails if a required property is not set by the time is called. + /// + [AttributeUsage(AttributeTargets.Property)] + internal class RequiredAttribute : Attribute + { + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs index b8f914819c0..649fe1fac3b 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs @@ -5,6 +5,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary.Impl { using System; + using System.Linq; /// /// A base class that implements . @@ -25,6 +26,7 @@ public void Execute() { try { + this.CheckRequired(); this.ExecuteInternal(); } catch @@ -39,5 +41,21 @@ public void Execute() /// Performs the actual step execution. /// protected abstract void ExecuteInternal(); + + private void CheckRequired() + { + var nullProperties = this.GetType().GetProperties() + .Where(p => p.GetCustomAttributes(typeof(RequiredAttribute), true).Any()) + .Where(p => string.IsNullOrEmpty($"{p.GetValue(this)}")) + .Select(p => p.Name) + .ToArray(); + + if (nullProperties.Length > 0) + { + throw new InvalidOperationException(string.Format( + "Following required properties are not set: {0}", + string.Join(", ", nullProperties))); + } + } } } From 1960d8baa4a490aa387cb5904260e6654647dbeb Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 18:38:19 -0300 Subject: [PATCH 07/37] Fixed bug in UninstallSummaryItem --- .../Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs index 21c902dfea8..f632b07813e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs @@ -50,7 +50,7 @@ internal UninstallSummaryItem(IStep step) /// internal static IEnumerable FromStep(IStep step) { - return step is IStepArray stepArray + return step is IStepArray stepArray && stepArray.Steps.Any() ? stepArray.Steps.SelectMany(s => FromStep(s)).ToArray() : new[] { new UninstallSummaryItem(step) }; } From 84d9f699035c069fe85c87c4bf31bd95738aa95b Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 25 Apr 2022 19:10:58 -0300 Subject: [PATCH 08/37] Implemented the clear cache step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 12 ++++--- .../Impl/ClearCacheStep.cs | 32 +++++++++++++++++++ .../Impl/IClearCacheStep.cs | 13 ++++++++ .../TelerikRemovalLibrary/Impl/IDataCache.cs | 19 +++++++++++ .../Impl/InternalDataCache.cs | 20 ++++++++++++ .../Impl/TelerikUninstaller.cs | 2 +- .../Modules/TelerikRemovalLibrary/Startup.cs | 2 ++ 7 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 50cde0887e1..5088d7238fa 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -53,23 +53,27 @@ + + + + + + + + - - - - diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs new file mode 100644 index 00000000000..a87a0643834 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + internal class ClearCacheStep : StepBase, IClearCacheStep + { + private readonly IDataCache dataCache; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public ClearCacheStep(IDataCache dataCache) + { + this.dataCache = dataCache ?? + throw new System.ArgumentNullException(nameof(dataCache)); + } + + /// + public override string Name => "Clear cache"; + + /// + protected override void ExecuteInternal() + { + this.dataCache.ClearCache(); + this.Success = true; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs new file mode 100644 index 00000000000..da69033a9d0 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + /// + /// Clears the cache. + /// + internal interface IClearCacheStep : IStep + { + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs new file mode 100644 index 00000000000..101eecff6e1 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using DotNetNuke.Common.Utilities; + + /// + /// Abstraction of the class to enable DI and unit testing. + /// + internal interface IDataCache + { + /// + /// Clears the cache. + /// + void ClearCache(); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs new file mode 100644 index 00000000000..ed7a419ef79 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary.Impl +{ + using DotNetNuke.Common.Utilities; + + /// + /// Implementation of that relies on the class. + /// + internal class InternalDataCache : IDataCache + { + /// + public void ClearCache() + { + DataCache.ClearCache(); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs index 7c9b58ae07d..4b696d53d7e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs @@ -134,7 +134,7 @@ private IStep RemoveSystemAttributeFromPackage(string packageName) private IStep ClearCache() { - return this.NullStep("Clear the cache"); + return this.GetService(); } private IStep UninstallExtension(string packageName) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 33700007e65..3f25df3d7a1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -25,6 +25,8 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(provider => TabController.Instance); // local + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); From c9cd5be5adeb835095eecf862aabf3c4cd4da9e0 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 09:16:57 -0300 Subject: [PATCH 09/37] Removed Impl namespace and rearranged files --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 56 +++++++++---------- .../{Impl => Shims}/FileSystemProvider.cs | 2 +- .../{Impl => Shims}/IDataCache.cs | 2 +- .../{Impl => Shims}/IDataProvider.cs | 2 +- .../IDesktopModuleController.cs | 2 +- .../{Impl => Shims}/IFileSystemProvider.cs | 2 +- .../IModuleDefinitionController.cs | 2 +- .../{Impl => Shims}/InternalDataCache.cs | 2 +- .../{Impl => Shims}/InternalDataProvider.cs | 2 +- .../InternalDesktopModuleController.cs | 2 +- .../InternalModuleDefinitionController.cs | 2 +- .../Modules/TelerikRemovalLibrary/Startup.cs | 1 - .../{Impl => Steps}/ClearCacheStep.cs | 2 +- .../{Impl => Steps}/ExecuteSqlStep.cs | 2 +- .../{Impl => Steps}/IClearCacheStep.cs | 2 +- .../{Impl => Steps}/IExecuteSqlStep.cs | 2 +- .../IInstallAvailablePackageStep.cs | 2 +- .../{Impl => Steps}/INullStep.cs | 2 +- .../IReplacePortalTabModuleStep.cs | 2 +- .../{Impl => Steps}/IReplaceTabModuleStep.cs | 2 +- .../{Impl => Steps}/IStep.cs | 2 +- .../{Impl => Steps}/IStepArray.cs | 2 +- .../InstallAvailablePackageStep.cs | 2 +- .../{Impl => Steps}/NullStep.cs | 2 +- .../ReplacePortalTabModuleStep.cs | 2 +- .../{Impl => Steps}/ReplaceTabModuleStep.cs | 2 +- .../{Impl => Steps}/RequiredAttribute.cs | 2 +- .../{Impl => Steps}/StepBase.cs | 2 +- .../{Impl => }/TelerikUninstaller.cs | 2 +- .../UninstallSummaryItem.cs | 2 - 30 files changed, 55 insertions(+), 58 deletions(-) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/FileSystemProvider.cs (96%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/IDataCache.cs (91%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/IDataProvider.cs (93%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/IDesktopModuleController.cs (92%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/IFileSystemProvider.cs (96%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/IModuleDefinitionController.cs (93%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/InternalDataCache.cs (92%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/InternalDataProvider.cs (92%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/InternalDesktopModuleController.cs (93%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Shims}/InternalModuleDefinitionController.cs (94%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/ClearCacheStep.cs (95%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/ExecuteSqlStep.cs (96%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IClearCacheStep.cs (87%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IExecuteSqlStep.cs (94%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IInstallAvailablePackageStep.cs (93%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/INullStep.cs (90%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IReplacePortalTabModuleStep.cs (94%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IReplaceTabModuleStep.cs (94%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IStep.cs (94%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/IStepArray.cs (92%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/InstallAvailablePackageStep.cs (99%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/NullStep.cs (93%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/ReplacePortalTabModuleStep.cs (99%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/ReplaceTabModuleStep.cs (98%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/RequiredAttribute.cs (92%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => Steps}/StepBase.cs (97%) rename DNN Platform/Modules/TelerikRemovalLibrary/{Impl => }/TelerikUninstaller.cs (99%) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 5088d7238fa..d52479339d1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -53,37 +53,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs similarity index 96% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs index ebc43293889..e4c21933a1e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/FileSystemProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Collections.Generic; using System.IO; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataCache.cs similarity index 91% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataCache.cs index 101eecff6e1..9729ec420cc 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataCache.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataCache.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using DotNetNuke.Common.Utilities; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataProvider.cs similarity index 93% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataProvider.cs index be9326d3b03..cf067eb968c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDataProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDataProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Data; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDesktopModuleController.cs similarity index 92% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDesktopModuleController.cs index cf1fe58bebb..f4d3cbf89e4 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IDesktopModuleController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IDesktopModuleController.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using DotNetNuke.Entities.Modules; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IFileSystemProvider.cs similarity index 96% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/IFileSystemProvider.cs index 0aa101f0547..b8d8f3e8ae6 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IFileSystemProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IFileSystemProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Collections.Generic; using System.IO; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IModuleDefinitionController.cs similarity index 93% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/IModuleDefinitionController.cs index 437cbfc04d8..280b0203a2d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IModuleDefinitionController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IModuleDefinitionController.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Collections.Generic; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs similarity index 92% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs index ed7a419ef79..f320c12bdbb 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataCache.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using DotNetNuke.Common.Utilities; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs similarity index 92% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs index e1c9e15ebd2..b0674cdb5c3 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDataProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Data; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs similarity index 93% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs index 70901839087..c32103d513c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalDesktopModuleController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using DotNetNuke.Entities.Modules; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs similarity index 94% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs index eccda8e1bc5..7a90f6b2a73 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InternalModuleDefinitionController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Collections.Generic; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 3f25df3d7a1..c931fef5be2 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -4,7 +4,6 @@ namespace Dnn.Modules.TelerikRemovalLibrary { - using Dnn.Modules.TelerikRemovalLibrary.Impl; using DotNetNuke.DependencyInjection; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Tabs; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs similarity index 95% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs index a87a0643834..10f4527090f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ClearCacheStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// internal class ClearCacheStep : StepBase, IClearCacheStep diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs similarity index 96% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs index aff9153cc48..5075f2efb3d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Data; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IClearCacheStep.cs similarity index 87% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IClearCacheStep.cs index da69033a9d0..388003ab07a 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IClearCacheStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IClearCacheStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// Clears the cache. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs similarity index 94% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs index b8dab231087..5a541aed3b3 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Data; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IInstallAvailablePackageStep.cs similarity index 93% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IInstallAvailablePackageStep.cs index c42342d1a15..e4d704e7b3e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IInstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IInstallAvailablePackageStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// Step to install packages. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs similarity index 90% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs index a1f3786f0f2..6c9aaf4543a 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/INullStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// A placeholder step. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplacePortalTabModuleStep.cs similarity index 94% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplacePortalTabModuleStep.cs index 8f9ff21e244..9976ed1d350 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplacePortalTabModuleStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// Replaces a given module in a page with another module, for a specific portal. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTabModuleStep.cs similarity index 94% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTabModuleStep.cs index 62a865682bd..7436861c60c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IReplaceTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTabModuleStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// Replaces a given module in a page with another module. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs similarity index 94% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs index fb69daa42b7..3efc454364a 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// /// An interface that represent a process step that can be executed. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStepArray.cs similarity index 92% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStepArray.cs index fa21e673688..15032f6ada3 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/IStepArray.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStepArray.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System.Collections.Generic; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs similarity index 99% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs index 9554070aed5..e96a034715f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/InstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.IO; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs similarity index 93% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs index 7240abcdd4d..1272c6fb908 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/NullStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { /// internal class NullStep : StepBase, INullStep diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs similarity index 99% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs index c603dd312f1..b6f5cb8c6d9 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Linq; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs similarity index 98% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs index ea9db4a36a2..c92bbc452d8 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/ReplaceTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Collections.Generic; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RequiredAttribute.cs similarity index 92% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/RequiredAttribute.cs index ef1cff766cb..4a326d7ec0a 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/RequiredAttribute.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RequiredAttribute.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs similarity index 97% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs index 649fe1fac3b..652c22ce2f9 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Linq; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs similarity index 99% rename from DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 4b696d53d7e..225335e314c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Impl/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace Dnn.Modules.TelerikRemovalLibrary.Impl +namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Collections.Generic; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs index f632b07813e..c3b4c89bb28 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs @@ -7,8 +7,6 @@ namespace Dnn.Modules.TelerikRemovalLibrary using System.Collections.Generic; using System.Linq; - using Dnn.Modules.TelerikRemovalLibrary.Impl; - /// /// A data transfer object with an uninstallation summary item. /// From 6856122902a9defcc6359a7aae7411535123d261 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 09:22:50 -0300 Subject: [PATCH 10/37] Renamed internal to shim --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 10 +++++----- .../{InternalDataCache.cs => DataCacheShim.cs} | 2 +- ...ernalDataProvider.cs => DataProviderShim.cs} | 2 +- ...roller.cs => DesktopModuleControllerShim.cs} | 2 +- ...temProvider.cs => FileSystemProviderShim.cs} | 2 +- ...ler.cs => ModuleDefinitionControllerShim.cs} | 2 +- .../Modules/TelerikRemovalLibrary/Startup.cs | 17 ++++++++++------- 7 files changed, 20 insertions(+), 17 deletions(-) rename DNN Platform/Modules/TelerikRemovalLibrary/Shims/{InternalDataCache.cs => DataCacheShim.cs} (91%) rename DNN Platform/Modules/TelerikRemovalLibrary/Shims/{InternalDataProvider.cs => DataProviderShim.cs} (91%) rename DNN Platform/Modules/TelerikRemovalLibrary/Shims/{InternalDesktopModuleController.cs => DesktopModuleControllerShim.cs} (90%) rename DNN Platform/Modules/TelerikRemovalLibrary/Shims/{FileSystemProvider.cs => FileSystemProviderShim.cs} (95%) rename DNN Platform/Modules/TelerikRemovalLibrary/Shims/{InternalModuleDefinitionController.cs => ModuleDefinitionControllerShim.cs} (90%) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index d52479339d1..8feb939161b 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -55,16 +55,16 @@ - + + + + - - - - + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataCacheShim.cs similarity index 91% rename from DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataCacheShim.cs index f320c12bdbb..1531a16402e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataCache.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataCacheShim.cs @@ -9,7 +9,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// /// Implementation of that relies on the class. /// - internal class InternalDataCache : IDataCache + internal class DataCacheShim : IDataCache { /// public void ClearCache() diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataProviderShim.cs similarity index 91% rename from DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataProviderShim.cs index b0674cdb5c3..223421cbe9b 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDataProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DataProviderShim.cs @@ -12,7 +12,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// An implementation of /// that relies on the class. /// - internal class InternalDataProvider : IDataProvider + internal class DataProviderShim : IDataProvider { /// public IDataReader ExecuteSQL(string sql) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DesktopModuleControllerShim.cs similarity index 90% rename from DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/DesktopModuleControllerShim.cs index c32103d513c..7a13a2f8297 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalDesktopModuleController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/DesktopModuleControllerShim.cs @@ -10,7 +10,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// A concrete implementation of /// that relies on the class. /// - internal class InternalDesktopModuleController : IDesktopModuleController + internal class DesktopModuleControllerShim : IDesktopModuleController { /// public DesktopModuleInfo GetDesktopModuleByModuleName(string moduleName, int portalID) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProviderShim.cs similarity index 95% rename from DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProviderShim.cs index e4c21933a1e..a84cbe3932f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProvider.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/FileSystemProviderShim.cs @@ -12,7 +12,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// /// Abstraction on file system utilities to enable unit testing. /// - internal class FileSystemProvider : IFileSystemProvider + internal class FileSystemProviderShim : IFileSystemProvider { /// public Stream CreateFileStream(string path, FileMode mode, FileAccess access) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/ModuleDefinitionControllerShim.cs similarity index 90% rename from DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs rename to DNN Platform/Modules/TelerikRemovalLibrary/Shims/ModuleDefinitionControllerShim.cs index 7a90f6b2a73..834878117c4 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InternalModuleDefinitionController.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/ModuleDefinitionControllerShim.cs @@ -12,7 +12,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// A concrete implementation of the interface /// that relies on the class. /// - internal class InternalModuleDefinitionController : IModuleDefinitionController + internal class ModuleDefinitionControllerShim : IModuleDefinitionController { /// public Dictionary GetModuleDefinitionsByDesktopModuleID(int desktopModuleID) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index c931fef5be2..fd43dc835bd 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -17,21 +17,24 @@ public class Startup : IDnnStartup /// public void ConfigureServices(IServiceCollection services) { + services.AddTransient(); + // core services.AddTransient(provider => LoggerSource.Instance); services.AddTransient(provider => ModuleController.Instance); services.AddTransient(provider => PackageController.Instance); services.AddTransient(provider => TabController.Instance); - // local + // shims + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + // steps services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); From f966def7b0cb50f309c3773e7ed75ebababc0d86 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 12:17:28 -0300 Subject: [PATCH 11/37] Moved exception logging to StepBase --- .../Steps/ClearCacheStep.cs | 10 ++++++-- .../Steps/ExecuteSqlStep.cs | 6 ++++- .../Steps/InstallAvailablePackageStep.cs | 4 +++ .../TelerikRemovalLibrary/Steps/NullStep.cs | 11 ++++++++ .../Steps/ReplacePortalTabModuleStep.cs | 4 +++ .../Steps/ReplaceTabModuleStep.cs | 5 +++- .../TelerikRemovalLibrary/Steps/StepBase.cs | 25 +++++++++++++++++-- .../TelerikUninstaller.cs | 4 --- 8 files changed, 59 insertions(+), 10 deletions(-) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs index 10f4527090f..30b3776fe9f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs @@ -4,6 +4,10 @@ namespace Dnn.Modules.TelerikRemovalLibrary { + using System; + + using DotNetNuke.Instrumentation; + /// internal class ClearCacheStep : StepBase, IClearCacheStep { @@ -12,11 +16,13 @@ internal class ClearCacheStep : StepBase, IClearCacheStep /// /// Initializes a new instance of the class. /// + /// An instance of . /// An instance of . - public ClearCacheStep(IDataCache dataCache) + public ClearCacheStep(ILoggerSource loggerSource, IDataCache dataCache) + : base(loggerSource) { this.dataCache = dataCache ?? - throw new System.ArgumentNullException(nameof(dataCache)); + throw new ArgumentNullException(nameof(dataCache)); } /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs index 5075f2efb3d..3d1ea72b80d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs @@ -7,6 +7,8 @@ namespace Dnn.Modules.TelerikRemovalLibrary using System; using System.Data; + using DotNetNuke.Instrumentation; + /// internal class ExecuteSqlStep : StepBase, IExecuteSqlStep { @@ -15,8 +17,10 @@ internal class ExecuteSqlStep : StepBase, IExecuteSqlStep /// /// Initializes a new instance of the class. /// + /// An instance of . /// An instance of . - public ExecuteSqlStep(IDataProvider dataProvider) + public ExecuteSqlStep(ILoggerSource loggerSource, IDataProvider dataProvider) + : base(loggerSource) { this.dataProvider = dataProvider ?? throw new ArgumentNullException(nameof(dataProvider)); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs index e96a034715f..a90a72a8b1c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs @@ -10,6 +10,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary using DotNetNuke.Abstractions.Application; using DotNetNuke.Common.Utilities; + using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer; using DotNetNuke.Services.Installer.Packages; @@ -23,13 +24,16 @@ internal class InstallAvailablePackageStep : StepBase, IInstallAvailablePackageS /// /// Initializes a new instance of the class. /// + /// An instance of . /// An instance of . /// An instance of . /// An instance of . public InstallAvailablePackageStep( + ILoggerSource loggerSource, IApplicationStatusInfo appStatusInfo, IFileSystemProvider fsProvider, IPackageController packageController) + : base(loggerSource) { this.appStatusInfo = appStatusInfo ?? throw new ArgumentNullException(nameof(appStatusInfo)); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs index 1272c6fb908..804e36909b3 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs @@ -4,9 +4,20 @@ namespace Dnn.Modules.TelerikRemovalLibrary { + using DotNetNuke.Instrumentation; + /// internal class NullStep : StepBase, INullStep { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public NullStep(ILoggerSource loggerSource) + : base(loggerSource) + { + } + /// public override string Name => this.InternalName; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs index b6f5cb8c6d9..54ba54597d5 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs @@ -10,6 +10,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Tabs; + using DotNetNuke.Instrumentation; /// internal class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleStep @@ -22,15 +23,18 @@ internal class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleSte /// /// Initializes a new instance of the class. /// + /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// An instance of . public ReplacePortalTabModuleStep( + ILoggerSource loggerSource, IModuleController moduleController, ITabController tabController, IDesktopModuleController desktopModuleController, IModuleDefinitionController moduleDefinitionController) + : base(loggerSource) { this.moduleController = moduleController ?? throw new ArgumentNullException(nameof(moduleController)); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs index c92bbc452d8..5c71a27bc90 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs @@ -10,6 +10,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary using DotNetNuke.Abstractions.Portals; using DotNetNuke.Entities.Portals; + using DotNetNuke.Instrumentation; /// internal partial class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, IStepArray @@ -20,8 +21,10 @@ internal partial class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, I /// /// Initializes a new instance of the class. /// + /// An instance of . /// An instance of . - public ReplaceTabModuleStep(IServiceProvider serviceProvider) + public ReplaceTabModuleStep(ILoggerSource loggerSource, IServiceProvider serviceProvider) + : base(loggerSource) { this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs index 652c22ce2f9..b71c41916c3 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs @@ -7,11 +7,27 @@ namespace Dnn.Modules.TelerikRemovalLibrary using System; using System.Linq; + using DotNetNuke.Instrumentation; + /// /// A base class that implements . /// internal abstract class StepBase : IStep { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public StepBase(ILoggerSource loggerSource) + { + if (loggerSource is null) + { + throw new ArgumentNullException(nameof(loggerSource)); + } + + this.Log = loggerSource.GetLogger(this.GetType()); + } + /// public abstract string Name { get; } @@ -21,6 +37,11 @@ internal abstract class StepBase : IStep /// public string Notes { get; protected set; } + /// + /// Gets an instance of specific to steps. + /// + protected ILog Log { get; private set; } + /// public void Execute() { @@ -29,9 +50,9 @@ public void Execute() this.CheckRequired(); this.ExecuteInternal(); } - catch + catch (Exception ex) { - // this.log.Error(ex); + this.Log.Error(ex); this.Success = false; this.Notes = "Internal error."; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 225335e314c..252e4d51c82 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -8,12 +8,10 @@ namespace Dnn.Modules.TelerikRemovalLibrary using System.Collections.Generic; using DotNetNuke.Common.Utilities; - using DotNetNuke.Instrumentation; /// internal class TelerikUninstaller : ITelerikUninstaller { - private readonly ILog log; private readonly IServiceProvider serviceProvider; private readonly List progress; @@ -26,8 +24,6 @@ public TelerikUninstaller(IServiceProvider serviceProvider) this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); - this.log = this.GetService().GetLogger(typeof(TelerikUninstaller)); - this.progress = new List(); } From c7b8b26e90e3d6c53f4782967595387bb829fba1 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 17:54:59 -0300 Subject: [PATCH 12/37] Added remove extension step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 7 ++ .../TelerikRemovalLibrary/Shims/IInstaller.cs | 17 ++++ .../Shims/InstallerShim.cs | 29 +++++++ .../Modules/TelerikRemovalLibrary/Startup.cs | 8 ++ .../Steps/IRemoveExtensionStep.cs | 17 ++++ .../Steps/IUninstallPackageStep.cs | 23 +++++ .../Steps/RemoveExtensionStep.cs | 86 +++++++++++++++++++ .../Steps/StepArrayBase.cs | 45 ++++++++++ .../Steps/UninstallPackageStep.cs | 78 +++++++++++++++++ .../TelerikUninstaller.cs | 44 +++------- 10 files changed, 320 insertions(+), 34 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Shims/IInstaller.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Shims/InstallerShim.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveExtensionStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IUninstallPackageStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 8feb939161b..e131b81df0e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -63,7 +63,9 @@ + + @@ -73,15 +75,20 @@ + + + + + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IInstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IInstaller.cs new file mode 100644 index 00000000000..44a676c5a10 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/IInstaller.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using DotNetNuke.Services.Installer; + + /// + /// An abstraction of the class. + /// + internal interface IInstaller + { + /// + bool UnInstall(bool deleteFiles); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InstallerShim.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InstallerShim.cs new file mode 100644 index 00000000000..f145211a250 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Shims/InstallerShim.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using DotNetNuke.Services.Installer; + using DotNetNuke.Services.Installer.Packages; + + /// + /// An implementation of that relies on the class. + /// + internal class InstallerShim : IInstaller + { + private Installer installer; + + /// + public InstallerShim(PackageInfo package, string physicalSitePath) + { + this.installer = new Installer(package, physicalSitePath); + } + + /// + public bool UnInstall(bool deleteFiles) + { + return this.installer.UnInstall(deleteFiles); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index fd43dc835bd..20bcef16983 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -4,6 +4,8 @@ namespace Dnn.Modules.TelerikRemovalLibrary { + using System; + using DotNetNuke.DependencyInjection; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Tabs; @@ -31,14 +33,20 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(this.InstallerFactory); // steps services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } + + private Func InstallerFactory(IServiceProvider provider) => + (package, physicalSitePath) => new InstallerShim(package, physicalSitePath); } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveExtensionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveExtensionStep.cs new file mode 100644 index 00000000000..b147598f081 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveExtensionStep.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Removes an extension. + /// + internal interface IRemoveExtensionStep : IStep + { + /// + /// Gets or sets the package name. + /// + string PackageName { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IUninstallPackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IUninstallPackageStep.cs new file mode 100644 index 00000000000..a04c17b51d7 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IUninstallPackageStep.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Uninstalls a package. + /// + internal interface IUninstallPackageStep : IStep + { + /// + /// Gets or sets a value indicating whether to delete the package files or not + /// in addition to uninstalling the package. + /// + bool DeleteFiles { get; set; } + + /// + /// Gets or sets the name of the package to uninstall. + /// + string PackageName { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs new file mode 100644 index 00000000000..a9eab3a0d9d --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Collections.Generic; + + using DotNetNuke.Instrumentation; + + /// + /// A container for an array of steps. + /// + internal class RemoveExtensionStep : StepArrayBase, IRemoveExtensionStep + { + private readonly IServiceProvider serviceProvider; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public RemoveExtensionStep(ILoggerSource loggerSource, IServiceProvider serviceProvider) + : base(loggerSource) + { + this.serviceProvider = serviceProvider ?? + throw new ArgumentNullException(nameof(serviceProvider)); + } + + /// + public override string Name => $"Remove extension '{this.PackageName}'"; + + /// + [Required] + public string PackageName { get; set; } + + /// + protected override void ExecuteInternal() + { + this.Steps = new List(new[] + { + this.RemoveSystemAttributeFromPackage(), + this.ClearCache(), + this.UninstallExtension(), + }); + + base.ExecuteInternal(); + } + + private IStep RemoveSystemAttributeFromPackage() + { + var commandFormat = string.Join( + Environment.NewLine, + "UPDATE {{databaseOwner}}{{objectQualifier}}Packages", + "SET IsSystemPackage = 0", + "WHERE [Name] = '{0}'"); + + var step = this.GetService(); + step.InternalName = $"Remove the 'System' attribute from package '{this.PackageName}'"; + step.CommandText = string.Format(commandFormat, this.PackageName); + + return step; + } + + private IStep ClearCache() + { + return this.GetService(); + } + + private IStep UninstallExtension() + { + var step = this.GetService(); + step.PackageName = this.PackageName; + step.DeleteFiles = true; + + return step; + } + + private T GetService() + where T : class + { + return (T)this.serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs new file mode 100644 index 00000000000..f4de324392b --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System.Collections.Generic; + + using DotNetNuke.Instrumentation; + + /// + /// A base class that implements . + /// + internal abstract class StepArrayBase : StepBase, IStepArray + { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public StepArrayBase(ILoggerSource loggerSource) + : base(loggerSource) + { + } + + /// + public IEnumerable Steps { get; protected set; } + + /// + protected override void ExecuteInternal() + { + this.Success = true; + + foreach (var step in this.Steps) + { + step.Execute(); + + if (step.Success.HasValue && step.Success.Value == false) + { + this.Success = false; + break; + } + } + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs new file mode 100644 index 00000000000..f0edb630c9d --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Linq; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Common.Utilities; + using DotNetNuke.Instrumentation; + using DotNetNuke.Services.Installer.Packages; + + /// + internal class UninstallPackageStep : StepBase, IUninstallPackageStep + { + private readonly IPackageController packageController; + private readonly IApplicationStatusInfo applicationStatusInfo; + private readonly Func installerFactory; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + /// An instance of . + /// A function that returns an instance of . + public UninstallPackageStep( + ILoggerSource loggerSource, + IPackageController packageController, + IApplicationStatusInfo applicationStatusInfo, + Func installerFactory) + : base(loggerSource) + { + this.packageController = packageController ?? + throw new ArgumentNullException(nameof(packageController)); + + this.applicationStatusInfo = applicationStatusInfo ?? + throw new ArgumentNullException(nameof(applicationStatusInfo)); + + this.installerFactory = installerFactory ?? + throw new ArgumentNullException(nameof(installerFactory)); + } + + /// + public override string Name => $"Uninstall the '{this.PackageName}' extension"; + + /// + public bool DeleteFiles { get; set; } + + /// + [Required] + public string PackageName { get; set; } + + /// + protected override void ExecuteInternal() + { + bool WithMatchingName(PackageInfo p) => + p.Name.Equals(this.PackageName, StringComparison.OrdinalIgnoreCase); + + var packageInfo = this.packageController + .GetExtensionPackages(Null.NullInteger, WithMatchingName) + .FirstOrDefault(); + + if (packageInfo == default) + { + this.Success = true; + this.Notes = $"Package '{this.PackageName}' was already uninstalled."; + return; + } + + var physicalPath = this.applicationStatusInfo.ApplicationMapPath; + var installer = this.installerFactory(packageInfo, physicalPath); + this.Success = installer.UnInstall(this.DeleteFiles); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 252e4d51c82..be890dd0911 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -41,19 +41,13 @@ public void Execute() "Module"), this.ReplaceModuleInPage("File Management", "Digital Asset Management", "ResourceManager"), this.ReplaceModuleInHostPage("File Management", "Digital Asset Management", "ResourceManager"), - this.RemoveSystemAttributeFromPackage("DigitalAssetsManagement"), - this.RemoveSystemAttributeFromPackage("DotNetNuke.Telerik.Web"), - this.RemoveSystemAttributeFromPackage("DotNetNuke.Web.Deprecated"), - this.RemoveSystemAttributeFromPackage("DotNetNuke.Website.Deprecated"), - this.RemoveSystemAttributeFromPackage("Admin.Messaging"), - this.ClearCache(), - this.UninstallExtension("Digital Assets Management"), - this.UninstallExtension("Messaging"), - this.UninstallExtension("DotNetNuke Telerik Web Components"), - this.UninstallExtension("DNN Deprecated Web Controls Library"), - this.UninstallExtension("DotNetNuke Deprecated Website Codebehind files"), - this.UninstallExtension("DNN Security HotFix 2017.1"), - this.UninstallExtension("RadEditor Manager"), + this.RemoveExtension("DigitalAssetsManagement"), + this.RemoveExtension("DotNetNuke.Telerik.Web"), + this.RemoveExtension("DotNetNuke.Web.Deprecated"), + this.RemoveExtension("DotNetNuke.Website.Deprecated"), + this.RemoveExtension("Admin.Messaging"), + this.RemoveExtension("DNN Security HotFix 2017.1"), + this.RemoveExtension("RadEditor Manager"), this.UpdateSiteUrlsConfig(), this.UpdateWebConfig(), this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Telerik_*"), @@ -113,31 +107,13 @@ private IStep ReplaceModuleInHostPage(string pageName, string oldModuleName, str return step; } - private IStep RemoveSystemAttributeFromPackage(string packageName) + private IStep RemoveExtension(string packageName) { - var commandFormat = string.Join( - Environment.NewLine, - "UPDATE {{databaseOwner}}{{objectQualifier}}Packages", - "SET IsSystemPackage = 0", - "WHERE [Name] = '{0}'"); - - var step = this.GetService(); - step.InternalName = $"Remove the 'System' attribute from package '{packageName}'"; - step.CommandText = string.Format(commandFormat, packageName); - + var step = this.GetService(); + step.PackageName = packageName; return step; } - private IStep ClearCache() - { - return this.GetService(); - } - - private IStep UninstallExtension(string packageName) - { - return this.NullStep($"Uninstall the '{packageName}' extension"); - } - private IStep UpdateSiteUrlsConfig() { return this.NullStep("Remove all Telerik rewrite rules from the SiteUrls.config file"); From 22ff2f576d238763d3ec8c562ecc1332360aaf1e Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 19:30:22 -0300 Subject: [PATCH 13/37] added update DataType list step --- .../TelerikRemovalLibrary/TelerikUninstaller.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index be890dd0911..4bb73e0b301 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -48,6 +48,8 @@ public void Execute() this.RemoveExtension("Admin.Messaging"), this.RemoveExtension("DNN Security HotFix 2017.1"), this.RemoveExtension("RadEditor Manager"), + this.UpdateDataTypeList("Date"), + this.UpdateDataTypeList("DateTime"), this.UpdateSiteUrlsConfig(), this.UpdateWebConfig(), this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Telerik_*"), @@ -114,6 +116,20 @@ private IStep RemoveExtension(string packageName) return step; } + private IStep UpdateDataTypeList(string value) + { + var commandFormat = string.Join( + Environment.NewLine, + "UPDATE {{databaseOwner}}[{{objectQualifier}}Lists]", + "SET Text = 'DotNetNuke.Web.UI.WebControls.Internal.PropertyEditorControls.{0}EditControl, DotNetNuke.Web'", + "WHERE ListName = 'DataType' AND Value = '{0}'"); + + var step = this.GetService(); + step.InternalName = $"Update provider for '{value}' in DataType list"; + step.CommandText = string.Format(commandFormat, value); + return step; + } + private IStep UpdateSiteUrlsConfig() { return this.NullStep("Remove all Telerik rewrite rules from the SiteUrls.config file"); From 07cabc2e8cd184e33be2ba50bbc569f7bd52fe88 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 19:44:40 -0300 Subject: [PATCH 14/37] added Quiet property to ClearCacheStep --- .../Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs | 2 ++ DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs | 6 ++++++ .../Modules/TelerikRemovalLibrary/Steps/StepBase.cs | 3 +++ .../Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs index 30b3776fe9f..234686fcf35 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs @@ -23,6 +23,8 @@ public ClearCacheStep(ILoggerSource loggerSource, IDataCache dataCache) { this.dataCache = dataCache ?? throw new ArgumentNullException(nameof(dataCache)); + + this.Quiet = true; } /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs index 3efc454364a..11f695764c6 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs @@ -19,6 +19,12 @@ internal interface IStep /// string Notes { get; } + /// + /// Gets a value indicating whether successful executions are logged to the progress report or not. + /// + /// Failed executions are always logged. + bool Quiet { get; } + /// /// Gets a value indicating whether the step succeeded, failed or was not executed. /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs index b71c41916c3..e252c8966e1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs @@ -37,6 +37,9 @@ public StepBase(ILoggerSource loggerSource) /// public string Notes { get; protected set; } + /// + public bool Quiet { get; protected set; } + /// /// Gets an instance of specific to steps. /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs index c3b4c89bb28..543d7ab4636 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/UninstallSummaryItem.cs @@ -48,6 +48,11 @@ internal UninstallSummaryItem(IStep step) /// internal static IEnumerable FromStep(IStep step) { + if (step.Quiet && step.Success.HasValue && step.Success.Value) + { + return new UninstallSummaryItem[0]; + } + return step is IStepArray stepArray && stepArray.Steps.Any() ? stepArray.Steps.SelectMany(s => FromStep(s)).ToArray() : new[] { new UninstallSummaryItem(step) }; From 2646ffdcf9855d548344fc3493bb1945b18df65a Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 20:23:15 -0300 Subject: [PATCH 15/37] Fixed 2017.1 hotfix package name --- .../Modules/TelerikRemovalLibrary/TelerikUninstaller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 4bb73e0b301..131ecc5554e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -46,7 +46,7 @@ public void Execute() this.RemoveExtension("DotNetNuke.Web.Deprecated"), this.RemoveExtension("DotNetNuke.Website.Deprecated"), this.RemoveExtension("Admin.Messaging"), - this.RemoveExtension("DNN Security HotFix 2017.1"), + this.RemoveExtension("DNNSecurityHotFix20171"), this.RemoveExtension("RadEditor Manager"), this.UpdateDataTypeList("Date"), this.UpdateDataTypeList("DateTime"), From 231f2a4fb54b9679fa3603b039333b246120e4c0 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 20:24:21 -0300 Subject: [PATCH 16/37] added records affected to SQL step notes --- .../Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs index 3d1ea72b80d..6b69552dcfb 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs @@ -43,6 +43,7 @@ public ExecuteSqlStep(ILoggerSource loggerSource, IDataProvider dataProvider) protected override void ExecuteInternal() { this.Result = this.dataProvider.ExecuteSQL(this.CommandText); + this.Notes = $"{this.Result.RecordsAffected} records affected."; this.Success = true; } } From fb8b3c43a82767ebaa2658304d0dc3f049e15ca5 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 20:25:29 -0300 Subject: [PATCH 17/37] added dependency cleanup to RemoveExtensionStep --- .../Steps/RemoveExtensionStep.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs index a9eab3a0d9d..6383cd1af64 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs @@ -43,6 +43,8 @@ protected override void ExecuteInternal() this.RemoveSystemAttributeFromPackage(), this.ClearCache(), this.UninstallExtension(), + this.DeleteDependencyRecords(), + this.ClearCache(), }); base.ExecuteInternal(); @@ -77,6 +79,20 @@ private IStep UninstallExtension() return step; } + private IStep DeleteDependencyRecords() + { + var commandFormat = string.Join( + Environment.NewLine, + "DELETE FROM {{databaseOwner}}{{objectQualifier}}PackageDependencies", + "WHERE PackageName = '{0}'"); + + var step = this.GetService(); + step.InternalName = $"Clean up dependency records for package '{this.PackageName}'"; + step.CommandText = string.Format(commandFormat, this.PackageName); + + return step; + } + private T GetService() where T : class { From e82a1512a13ae76f6c6dd76183439e729c45ffe3 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 23:08:03 -0300 Subject: [PATCH 18/37] Show file names only not paths --- DNN Platform/Modules/TelerikRemoval/View.ascx.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs index 8cfe9cfebf1..d921ae15169 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -6,6 +6,7 @@ namespace Dnn.Modules.TelerikRemoval { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; @@ -181,7 +182,8 @@ private void InitMainMultiView() return; } - var assemblies = telerikUtils.GetAssembliesThatDependOnTelerik(); + var assemblies = telerikUtils.GetAssembliesThatDependOnTelerik() + .Select(a => Path.GetFileName(a)); if (!assemblies.Any()) { From c1dd9881581bd40b9e7929858756797391c785fc Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Tue, 26 Apr 2022 23:08:46 -0300 Subject: [PATCH 19/37] Fixed RadEditor Manager package name --- .../Modules/TelerikRemovalLibrary/TelerikUninstaller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 131ecc5554e..f84099d1b24 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -47,7 +47,7 @@ public void Execute() this.RemoveExtension("DotNetNuke.Website.Deprecated"), this.RemoveExtension("Admin.Messaging"), this.RemoveExtension("DNNSecurityHotFix20171"), - this.RemoveExtension("RadEditor Manager"), + this.RemoveExtension("DotNetNuke.RadEditorProvider"), this.UpdateDataTypeList("Date"), this.UpdateDataTypeList("DateTime"), this.UpdateSiteUrlsConfig(), From 9b4d57ad4a655f105c8788bc78e173c317279c59 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 00:12:46 -0300 Subject: [PATCH 20/37] Simplified step name property --- .../Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs | 6 ------ .../TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs | 5 ----- .../Modules/TelerikRemovalLibrary/Steps/INullStep.cs | 4 ---- DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs | 4 ++-- .../Modules/TelerikRemovalLibrary/Steps/NullStep.cs | 8 -------- .../TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs | 4 ++-- .../Modules/TelerikRemovalLibrary/Steps/StepBase.cs | 2 +- .../Modules/TelerikRemovalLibrary/TelerikUninstaller.cs | 4 ++-- 8 files changed, 7 insertions(+), 30 deletions(-) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs index 6b69552dcfb..4b0a663f3bf 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs @@ -30,12 +30,6 @@ public ExecuteSqlStep(ILoggerSource loggerSource, IDataProvider dataProvider) [Required] public string CommandText { get; set; } - /// - public string InternalName { get; set; } - - /// - public override string Name => this.InternalName; - /// public IDataReader Result { get; private set; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs index 5a541aed3b3..09f6d3fc5fb 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IExecuteSqlStep.cs @@ -16,11 +16,6 @@ internal interface IExecuteSqlStep : IStep /// string CommandText { get; set; } - /// - /// Gets or sets the step's internal name. - /// - string InternalName { get; set; } - /// /// Gets an instance of with the results of the command execution. /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs index 6c9aaf4543a..be5ba5b45f0 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs @@ -9,9 +9,5 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// internal interface INullStep : IStep { - /// - /// Gets or sets the internal step name. - /// - string InternalName { get; set; } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs index 11f695764c6..3eb0819fccd 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IStep.cs @@ -10,9 +10,9 @@ namespace Dnn.Modules.TelerikRemovalLibrary internal interface IStep { /// - /// Gets the step name. + /// Gets or sets the step name. /// - string Name { get; } + string Name { get; set; } /// /// Gets the remarks collected during step execution. diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs index 804e36909b3..96358df29f1 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs @@ -18,14 +18,6 @@ public NullStep(ILoggerSource loggerSource) { } - /// - public override string Name => this.InternalName; - - /// - /// Gets or sets the step's internal name. - /// - public string InternalName { get; set; } - /// protected override void ExecuteInternal() { diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs index 6383cd1af64..76bf8f784cd 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs @@ -59,7 +59,7 @@ private IStep RemoveSystemAttributeFromPackage() "WHERE [Name] = '{0}'"); var step = this.GetService(); - step.InternalName = $"Remove the 'System' attribute from package '{this.PackageName}'"; + step.Name = $"Remove the 'System' attribute from package '{this.PackageName}'"; step.CommandText = string.Format(commandFormat, this.PackageName); return step; @@ -87,7 +87,7 @@ private IStep DeleteDependencyRecords() "WHERE PackageName = '{0}'"); var step = this.GetService(); - step.InternalName = $"Clean up dependency records for package '{this.PackageName}'"; + step.Name = $"Clean up dependency records for package '{this.PackageName}'"; step.CommandText = string.Format(commandFormat, this.PackageName); return step; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs index e252c8966e1..7a148ff966d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs @@ -29,7 +29,7 @@ public StepBase(ILoggerSource loggerSource) } /// - public abstract string Name { get; } + public virtual string Name { get; set; } /// public bool? Success { get; protected set; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index f84099d1b24..252a9232154 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -125,7 +125,7 @@ private IStep UpdateDataTypeList(string value) "WHERE ListName = 'DataType' AND Value = '{0}'"); var step = this.GetService(); - step.InternalName = $"Update provider for '{value}' in DataType list"; + step.Name = $"Update provider for '{value}' in DataType list"; step.CommandText = string.Format(commandFormat, value); return step; } @@ -148,7 +148,7 @@ private IStep RemoveUninstalledExtensionFiles(string packageName) private IStep NullStep(string name) { var step = this.GetService(); - step.InternalName = name; + step.Name = name; return step; } From 4d23c13f346f885540c6799442d6f1c684c2c578 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 01:40:06 -0300 Subject: [PATCH 21/37] Implemented replace text in file step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 2 + .../Modules/TelerikRemovalLibrary/Startup.cs | 1 + .../Steps/IReplaceTextInFileStep.cs | 32 ++++++ .../Steps/ReplaceTextInFileStep.cs | 98 +++++++++++++++++++ .../TelerikUninstaller.cs | 7 +- 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index e131b81df0e..f9c0f654dbc 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -78,6 +78,7 @@ + @@ -85,6 +86,7 @@ + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 20bcef16983..d35ac53fbed 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -43,6 +43,7 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs new file mode 100644 index 00000000000..8e03c9c90a9 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Find and replace text in files. + /// + internal interface IReplaceTextInFileStep : IStep + { + /// + /// Gets or sets the file path relative to the site's root folder. + /// + string RelativeFilePath { get; set; } + + /// + /// Gets or sets the regular expression pattern to match. + /// + string SearchPattern { get; set; } + + /// + /// Gets or sets the text to replace the match with. + /// + string Replacement { get; set; } + + /// + /// Gets the number of matches found in text. + /// + int MatchCount { get; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs new file mode 100644 index 00000000000..f07de39b048 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.IO; + using System.Text.RegularExpressions; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + /// Find and replace text in files. + /// + internal class ReplaceTextInFileStep : StepBase, IReplaceTextInFileStep + { + private readonly IApplicationStatusInfo applicationStatusInfo; + private readonly IFileSystemProvider fileSystemProvider; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + /// An instance of . + public ReplaceTextInFileStep( + ILoggerSource loggerSource, + IApplicationStatusInfo applicationStatusInfo, + IFileSystemProvider fileSystemProvider) + : base(loggerSource) + { + this.applicationStatusInfo = applicationStatusInfo ?? + throw new ArgumentNullException(nameof(applicationStatusInfo)); + + this.fileSystemProvider = fileSystemProvider ?? + throw new ArgumentNullException(nameof(fileSystemProvider)); + } + + /// + [Required] + public string RelativeFilePath { get; set; } + + /// + [Required] + public string SearchPattern { get; set; } + + /// + public string Replacement { get; set; } + + /// + public int MatchCount { get; protected set; } + + /// + protected override void ExecuteInternal() + { + this.Success = true; + + var root = this.applicationStatusInfo.ApplicationMapPath + "\\"; + var combined = Path.Combine(root, this.RelativeFilePath); + var fullPath = Path.GetFullPath(combined); + var content = this.ReadFile(fullPath); + var matches = Regex.Matches(content, this.SearchPattern, RegexOptions.Singleline); + this.MatchCount = matches.Count; + + if (this.MatchCount > 0) + { + this.Notes = $"Found {this.MatchCount} matches."; + + var replaced = Regex.Replace(content, this.SearchPattern, this.Replacement, RegexOptions.Singleline); + this.WriteFile(fullPath, replaced); + } + else + { + this.Notes = "No matches found."; + } + } + + private string ReadFile(string path) + { + using (var stream = this.fileSystemProvider.CreateFileStream(path, FileMode.Open, FileAccess.Read)) + using (var reader = new StreamReader(stream)) + { + return reader.ReadToEnd(); + } + } + + private void WriteFile(string path, string content) + { + using (var stream = this.fileSystemProvider.CreateFileStream(path, FileMode.Create, FileAccess.Write)) + using (var writer = new StreamWriter(stream)) + { + writer.Write(content); + } + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 252a9232154..5e1f51b06eb 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -132,7 +132,12 @@ private IStep UpdateDataTypeList(string value) private IStep UpdateSiteUrlsConfig() { - return this.NullStep("Remove all Telerik rewrite rules from the SiteUrls.config file"); + var step = this.GetService(); + step.Name = "Remove all Telerik rewrite rules from the SiteUrls.config file"; + step.RelativeFilePath = "Config/SiteUrls.config"; + step.SearchPattern = @"\s*[^<]*Telerik[^<]*.*?\s*"; + step.Replacement = string.Empty; + return step; } private IStep UpdateWebConfig() From 1732dab2d1aa24829cecc90e203caafc52b8ca18 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 15:32:45 -0300 Subject: [PATCH 22/37] Implemented Web.config steps --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 10 +- .../Modules/TelerikRemovalLibrary/Startup.cs | 4 +- .../Steps/IRemoveItemFromCollectionStep.cs | 28 ++++++ .../IRemoveTelerikBindingRedirectsStep.cs | 13 +++ .../Steps/IRemoveTelerikRewriterRulesStep.cs | 13 +++ .../Steps/IReplaceTextInFileStep.cs | 32 ------ .../TelerikRemovalLibrary/Steps/IXmlStep.cs | 17 ++++ .../Steps/RemoveItemFromCollectionStep.cs | 76 ++++++++++++++ .../RemoveTelerikBindingRedirectsStep.cs | 77 +++++++++++++++ .../Steps/RemoveTelerikRewriterRulesStep.cs | 66 +++++++++++++ .../Steps/ReplaceTextInFileStep.cs | 98 ------------------- .../Steps/XmlStepBase.cs | 74 ++++++++++++++ .../TelerikUninstaller.cs | 25 +++-- 13 files changed, 392 insertions(+), 141 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveItemFromCollectionStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikBindingRedirectsStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikRewriterRulesStep.cs delete mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IXmlStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs delete mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index f9c0f654dbc..dc534f2055f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -76,21 +76,27 @@ + + + - + + + + - + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index d35ac53fbed..63e4f064269 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -41,9 +41,11 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveItemFromCollectionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveItemFromCollectionStep.cs new file mode 100644 index 00000000000..397e6f20db6 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveItemFromCollectionStep.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Removes items in the specified section of the Web.config file that match a search term. + /// + internal interface IRemoveItemFromCollectionStep : IXmlStep + { + /// + /// Gets or sets the XPath expression of the target collection. + /// + string CollectionPath { get; set; } + + /// + /// Gets or sets the text that items must contain for them to get removed from the collection + /// (case insensitive). + /// + string SearchTerm { get; set; } + + /// + /// Gets or sets the attribute names to include in the search. + /// + string AttributeNamesToIncludeInSearch { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikBindingRedirectsStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikBindingRedirectsStep.cs new file mode 100644 index 00000000000..6a8421de2fe --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikBindingRedirectsStep.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Removes any Telerik binding redirects found in the Web.config file. + /// + internal interface IRemoveTelerikBindingRedirectsStep : IStep + { + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikRewriterRulesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikRewriterRulesStep.cs new file mode 100644 index 00000000000..2141fd0c2ee --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IRemoveTelerikRewriterRulesStep.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Removes any Telerik references found in the Config/SiteUrls.config file. + /// + internal interface IRemoveTelerikRewriterRulesStep : IStep + { + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs deleted file mode 100644 index 8e03c9c90a9..00000000000 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IReplaceTextInFileStep.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace Dnn.Modules.TelerikRemovalLibrary -{ - /// - /// Find and replace text in files. - /// - internal interface IReplaceTextInFileStep : IStep - { - /// - /// Gets or sets the file path relative to the site's root folder. - /// - string RelativeFilePath { get; set; } - - /// - /// Gets or sets the regular expression pattern to match. - /// - string SearchPattern { get; set; } - - /// - /// Gets or sets the text to replace the match with. - /// - string Replacement { get; set; } - - /// - /// Gets the number of matches found in text. - /// - int MatchCount { get; } - } -} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IXmlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IXmlStep.cs new file mode 100644 index 00000000000..3b58b2bd09d --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IXmlStep.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Contract for XML file steps. + /// + internal interface IXmlStep : IStep + { + /// + /// Gets or sets the path of the XML file to load, relative to the application root path. + /// + string RelativeFilePath { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs new file mode 100644 index 00000000000..e7c4a82dc6d --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs @@ -0,0 +1,76 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Linq; + using System.Xml; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + internal class RemoveItemFromCollectionStep : XmlStepBase, IRemoveItemFromCollectionStep + { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public RemoveItemFromCollectionStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, applicationStatusInfo) + { + } + + /// + [Required] + public virtual string CollectionPath { get; set; } + + /// + [Required] + public virtual string AttributeNamesToIncludeInSearch { get; set; } + + /// + [Required] + public string SearchTerm { get; set; } + + /// + protected override void ProcessXml(XmlDocument doc) + { + this.Success = true; + + var collection = doc.SelectSingleNode(this.CollectionPath); + if (collection is null) + { + this.Notes = $"{this.CollectionPath} section not found."; + return; + } + + var matchCount = 0; + + collection.SelectNodes("add|remove", this.NamespaceManager) + .Cast() + .Select(e => new { Item = e, Text = this.JoinAttributesToIncludeInSearch(e) }) + .Where(x => x.Text.IndexOf(this.SearchTerm, StringComparison.OrdinalIgnoreCase) >= 0) + .Select(x => x.Item) + .ToList() + .ForEach(item => + { + collection.RemoveChild(item); + matchCount++; + }); + + this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + } + + private string JoinAttributesToIncludeInSearch(XmlElement element) + { + var attributeValues = this.AttributeNamesToIncludeInSearch.Split(',') + .Select(attrName => element.GetAttribute(attrName.Trim())); + + return string.Join("|", attributeValues); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs new file mode 100644 index 00000000000..1b01e98caa8 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs @@ -0,0 +1,77 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Linq; + using System.Xml; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + internal class RemoveTelerikBindingRedirectsStep : XmlStepBase, IRemoveTelerikBindingRedirectsStep + { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public RemoveTelerikBindingRedirectsStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, applicationStatusInfo) + { + } + + /// + public override string Name => "Remove Telerik assembly binding redirects"; + + /// + [Required] + public override string RelativeFilePath => "Web.config"; + + /// + protected override void ConfigureNamespaceManager() + { + this.NamespaceManager.AddNamespace("asm", "urn:schemas-microsoft-com:asm.v1"); + } + + /// + protected override void ProcessXml(XmlDocument doc) + { + const string AssemblyBindingPath = "/configuration/runtime/asm:assemblyBinding"; + + this.Success = true; + + var assemblyBinding = doc.SelectSingleNode(AssemblyBindingPath, this.NamespaceManager); + if (assemblyBinding is null) + { + this.Notes = $"{AssemblyBindingPath} section not found."; + return; + } + + var matchCount = 0; + + assemblyBinding.SelectNodes("asm:dependentAssembly", this.NamespaceManager) + .Cast() + .Select(e => new + { + dependentAssembly = e, + assemblyIdentity = (XmlElement)e.SelectSingleNode("asm:assemblyIdentity", this.NamespaceManager), + }) + .Where(x => x.assemblyIdentity != null) + .Select(x => new { x.dependentAssembly, Name = $"{x.assemblyIdentity.GetAttribute("name")}" }) + .Where(x => x.Name.IndexOf("telerik", StringComparison.OrdinalIgnoreCase) >= 0) + .Select(x => x.dependentAssembly) + .ToList() + .ForEach(a => + { + assemblyBinding.RemoveChild(a); + matchCount++; + }); + + this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs new file mode 100644 index 00000000000..8287581c7dd --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Linq; + using System.Xml; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + internal class RemoveTelerikRewriterRulesStep : XmlStepBase, IRemoveTelerikRewriterRulesStep + { + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public RemoveTelerikRewriterRulesStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, applicationStatusInfo) + { + } + + /// + public override string Name => "Remove Telerik URL rewrite rules"; + + /// + [Required] + public override string RelativeFilePath => "Config/SiteUrls.config"; + + /// + protected override void ProcessXml(XmlDocument doc) + { + const string RulesPath = "/RewriterConfig/Rules"; + + this.Success = true; + + var rules = doc.SelectSingleNode(RulesPath); + if (rules is null) + { + this.Notes = $"{RulesPath} section not found."; + return; + } + + var matchCount = 0; + + rules.SelectNodes("RewriterRule") + .Cast() + .Select(e => new { RewriterRule = e, LookFor = (XmlElement)e.SelectSingleNode("LookFor") }) + .Where(x => x.LookFor != null && x.LookFor.InnerText != null) + .Where(x => x.LookFor.InnerText.IndexOf("telerik", StringComparison.OrdinalIgnoreCase) >= 0) + .Select(x => x.RewriterRule) + .ToList() + .ForEach(rewriterRule => + { + rules.RemoveChild(rewriterRule); + matchCount++; + }); + + this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs deleted file mode 100644 index f07de39b048..00000000000 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTextInFileStep.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace Dnn.Modules.TelerikRemovalLibrary -{ - using System; - using System.IO; - using System.Text.RegularExpressions; - - using DotNetNuke.Abstractions.Application; - using DotNetNuke.Instrumentation; - - /// - /// Find and replace text in files. - /// - internal class ReplaceTextInFileStep : StepBase, IReplaceTextInFileStep - { - private readonly IApplicationStatusInfo applicationStatusInfo; - private readonly IFileSystemProvider fileSystemProvider; - - /// - /// Initializes a new instance of the class. - /// - /// An instance of . - /// An instance of . - /// An instance of . - public ReplaceTextInFileStep( - ILoggerSource loggerSource, - IApplicationStatusInfo applicationStatusInfo, - IFileSystemProvider fileSystemProvider) - : base(loggerSource) - { - this.applicationStatusInfo = applicationStatusInfo ?? - throw new ArgumentNullException(nameof(applicationStatusInfo)); - - this.fileSystemProvider = fileSystemProvider ?? - throw new ArgumentNullException(nameof(fileSystemProvider)); - } - - /// - [Required] - public string RelativeFilePath { get; set; } - - /// - [Required] - public string SearchPattern { get; set; } - - /// - public string Replacement { get; set; } - - /// - public int MatchCount { get; protected set; } - - /// - protected override void ExecuteInternal() - { - this.Success = true; - - var root = this.applicationStatusInfo.ApplicationMapPath + "\\"; - var combined = Path.Combine(root, this.RelativeFilePath); - var fullPath = Path.GetFullPath(combined); - var content = this.ReadFile(fullPath); - var matches = Regex.Matches(content, this.SearchPattern, RegexOptions.Singleline); - this.MatchCount = matches.Count; - - if (this.MatchCount > 0) - { - this.Notes = $"Found {this.MatchCount} matches."; - - var replaced = Regex.Replace(content, this.SearchPattern, this.Replacement, RegexOptions.Singleline); - this.WriteFile(fullPath, replaced); - } - else - { - this.Notes = "No matches found."; - } - } - - private string ReadFile(string path) - { - using (var stream = this.fileSystemProvider.CreateFileStream(path, FileMode.Open, FileAccess.Read)) - using (var reader = new StreamReader(stream)) - { - return reader.ReadToEnd(); - } - } - - private void WriteFile(string path, string content) - { - using (var stream = this.fileSystemProvider.CreateFileStream(path, FileMode.Create, FileAccess.Write)) - using (var writer = new StreamWriter(stream)) - { - writer.Write(content); - } - } - } -} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs new file mode 100644 index 00000000000..9d83065b6f5 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.IO; + using System.Xml; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + internal abstract class XmlStepBase : StepBase, IXmlStep + { + private readonly IApplicationStatusInfo applicationStatusInfo; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + public XmlStepBase( + ILoggerSource loggerSource, + IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource) + { + this.applicationStatusInfo = applicationStatusInfo ?? + throw new ArgumentNullException(nameof(applicationStatusInfo)); + } + + /// + [Required] + public virtual string RelativeFilePath { get; set; } + + /// + /// Gets the instance associated with the XML document. + /// + protected XmlNamespaceManager NamespaceManager { get; private set; } + + /// + protected override void ExecuteInternal() + { + var doc = new XmlDocument { PreserveWhitespace = true }; + var root = this.applicationStatusInfo.ApplicationMapPath + "\\"; + var fullPath = Path.GetFullPath(Path.Combine(root, this.RelativeFilePath)); + doc.Load(fullPath); + + this.NamespaceManager = new XmlNamespaceManager(doc.NameTable); + this.ConfigureNamespaceManager(); + + this.ProcessXml(doc); + + if (this.Success.HasValue && this.Success.Value) + { + doc.Save(fullPath); + } + } + + /// + /// Provides an opportunity for derived classes to configure the namespace manager. + /// + protected virtual void ConfigureNamespaceManager() + { + } + + /// + /// Performs the actual processing of the XML document. + /// + /// The XML document to process. + protected abstract void ProcessXml(XmlDocument doc); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 5e1f51b06eb..da7db7aab5c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -51,7 +51,10 @@ public void Execute() this.UpdateDataTypeList("Date"), this.UpdateDataTypeList("DateTime"), this.UpdateSiteUrlsConfig(), - this.UpdateWebConfig(), + this.UpdateWebConfig("/configuration/appSettings", "key"), + this.UpdateWebConfig("/configuration/system.webServer/handlers", "name, type"), + this.UpdateWebConfig("/configuration/system.webServer/modules", "name, type"), + this.RemoveTelerikBindingRedirects(), this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Telerik_*"), this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Web.Deprecated_*"), this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Website.Deprecated_*"), @@ -132,17 +135,23 @@ private IStep UpdateDataTypeList(string value) private IStep UpdateSiteUrlsConfig() { - var step = this.GetService(); - step.Name = "Remove all Telerik rewrite rules from the SiteUrls.config file"; - step.RelativeFilePath = "Config/SiteUrls.config"; - step.SearchPattern = @"\s*[^<]*Telerik[^<]*.*?\s*"; - step.Replacement = string.Empty; + return this.GetService(); + } + + private IStep UpdateWebConfig(string collectionPath, string attributeNames) + { + var step = this.GetService(); + step.Name = $"Web.config: remove Telerik from {collectionPath}"; + step.RelativeFilePath = "Web.config"; + step.CollectionPath = collectionPath; + step.AttributeNamesToIncludeInSearch = attributeNames; + step.SearchTerm = "telerik"; return step; } - private IStep UpdateWebConfig() + private IStep RemoveTelerikBindingRedirects() { - return this.NullStep("Remove all Telerik references from the Web.config file"); + return this.GetService(); } private IStep RemoveUninstalledExtensionFiles(string packageName) From d23747bf3ada662372cb492ce12d5b0001c25d47 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 18:30:55 -0300 Subject: [PATCH 23/37] Added extension files cleanup step --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 2 + .../Modules/TelerikRemovalLibrary/Startup.cs | 1 + .../Steps/DeleteFilesStep.cs | 70 +++++++++++++++++++ .../Steps/IDeleteFilesStep.cs | 33 +++++++++ .../TelerikUninstaller.cs | 18 +++-- 5 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/IDeleteFilesStep.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index dc534f2055f..efb9090953c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -69,8 +69,10 @@ + + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 63e4f064269..23b45a8598d 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -37,6 +37,7 @@ public void ConfigureServices(IServiceCollection services) // steps services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs new file mode 100644 index 00000000000..ae33f2ecc1c --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.IO; + + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Instrumentation; + + /// + /// Deletes files. + /// + internal class DeleteFilesStep : StepBase, IDeleteFilesStep + { + private readonly IFileSystemProvider fileSystemProvider; + private readonly IApplicationStatusInfo applicationStatusInfo; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + /// An instance of . + /// An instance of . + public DeleteFilesStep( + ILoggerSource loggerSource, + IFileSystemProvider fileSystemProvider, + IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource) + { + this.fileSystemProvider = fileSystemProvider ?? + throw new ArgumentNullException(nameof(fileSystemProvider)); + + this.applicationStatusInfo = applicationStatusInfo ?? + throw new ArgumentNullException(nameof(applicationStatusInfo)); + } + + /// + [Required] + public string RelativePath { get; set; } + + /// + [Required] + public string SearchPattern { get; set; } + + /// + [Required] + public SearchOption SearchOption { get; set; } + + /// + protected override void ExecuteInternal() + { + var count = 0; + var appPath = this.applicationStatusInfo.ApplicationMapPath + "\\"; + var fullPath = Path.GetFullPath(Path.Combine(appPath, this.RelativePath)); + var files = this.fileSystemProvider.EnumerateFiles(fullPath, this.SearchPattern, this.SearchOption); + + foreach (var file in files) + { + this.fileSystemProvider.DeleteFile(file); + count++; + } + + this.Success = true; + this.Notes = $"{count} files deleted."; + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IDeleteFilesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IDeleteFilesStep.cs new file mode 100644 index 00000000000..10914edad3a --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/IDeleteFilesStep.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System.IO; + + /// + /// Deletes files. + /// + internal interface IDeleteFilesStep : IStep + { + /// + /// Gets or sets the path to the directory to search, relative to the application root path. + /// + string RelativePath { get; set; } + + /// + /// Gets or sets the search string to match against the names of files in path. + /// This parameter can contain a combination of valid literal path and wildcard + /// (* and ?) characters, but doesn't support regular expressions. + /// + string SearchPattern { get; set; } + + /// + /// Gets or sets an enumeration value that specifies whether the search operation should + /// include only the current directory or should include all subdirectories. + /// The default value is . + /// + SearchOption SearchOption { get; set; } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index da7db7aab5c..d58b08d1e89 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -6,6 +6,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary { using System; using System.Collections.Generic; + using System.IO; using DotNetNuke.Common.Utilities; @@ -55,10 +56,10 @@ public void Execute() this.UpdateWebConfig("/configuration/system.webServer/handlers", "name, type"), this.UpdateWebConfig("/configuration/system.webServer/modules", "name, type"), this.RemoveTelerikBindingRedirects(), - this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Telerik_*"), - this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Web.Deprecated_*"), - this.RemoveUninstalledExtensionFiles("Library_DotNetNuke.Website.Deprecated_*"), - this.RemoveUninstalledExtensionFiles("DNNSecurityHotFix*"), + this.RemoveUninstalledExtensionFiles("App_Data/ExtensionPackages", "Library_DotNetNuke.Telerik.Web_*"), + this.RemoveUninstalledExtensionFiles("App_Data/ExtensionPackages", "Library_DotNetNuke.Web.Deprecated_*"), + this.RemoveUninstalledExtensionFiles("App_Data/ExtensionPackages", "Library_DotNetNuke.Website.Deprecated_*"), + this.RemoveUninstalledExtensionFiles("App_Data/ExtensionPackages", "Module_DNNSecurityHotFix*"), }; var skip = false; @@ -154,9 +155,14 @@ private IStep RemoveTelerikBindingRedirects() return this.GetService(); } - private IStep RemoveUninstalledExtensionFiles(string packageName) + private IStep RemoveUninstalledExtensionFiles(string relativePath, string searchPattern, bool recurse = false) { - return this.NullStep($"Remove extension files '{packageName}'"); + var step = this.GetService(); + step.Name = $"Delete files '{relativePath}/{searchPattern}'"; + step.RelativePath = relativePath; + step.SearchPattern = searchPattern; + step.SearchOption = recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; + return step; } private IStep NullStep(string name) From 7f59fe8aa26d96992768dd84a30939bf42e163aa Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 18:32:59 -0300 Subject: [PATCH 24/37] Removed unused NullStep --- .../Dnn.Modules.TelerikRemovalLibrary.csproj | 2 -- .../Modules/TelerikRemovalLibrary/Startup.cs | 1 - .../TelerikRemovalLibrary/Steps/INullStep.cs | 13 --------- .../TelerikRemovalLibrary/Steps/NullStep.cs | 28 ------------------- .../TelerikUninstaller.cs | 7 ----- 5 files changed, 51 deletions(-) delete mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs delete mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index efb9090953c..024f0fb0898 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -76,7 +76,6 @@ - @@ -87,7 +86,6 @@ - diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index 23b45a8598d..af1c490b005 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -40,7 +40,6 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs deleted file mode 100644 index be5ba5b45f0..00000000000 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/INullStep.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace Dnn.Modules.TelerikRemovalLibrary -{ - /// - /// A placeholder step. - /// - internal interface INullStep : IStep - { - } -} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs deleted file mode 100644 index 96358df29f1..00000000000 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/NullStep.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace Dnn.Modules.TelerikRemovalLibrary -{ - using DotNetNuke.Instrumentation; - - /// - internal class NullStep : StepBase, INullStep - { - /// - /// Initializes a new instance of the class. - /// - /// An instance of . - public NullStep(ILoggerSource loggerSource) - : base(loggerSource) - { - } - - /// - protected override void ExecuteInternal() - { - this.Success = false; - this.Notes = "Not yet implemented."; - } - } -} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index d58b08d1e89..7fa850a5b9e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -165,13 +165,6 @@ private IStep RemoveUninstalledExtensionFiles(string relativePath, string search return step; } - private IStep NullStep(string name) - { - var step = this.GetService(); - step.Name = name; - return step; - } - private T GetService() where T : class { From 29ed20230190626b176524c01373fb0af4315925 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Wed, 27 Apr 2022 18:48:05 -0300 Subject: [PATCH 25/37] Disabling the submit button after click --- DNN Platform/Modules/TelerikRemoval/View.ascx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index 3bb98a5f95a..2693d0317a2 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -39,7 +39,7 @@

- +
From 7484ff323aa164bc1c95e62b47a8c3d9d51d98f7 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Thu, 28 Apr 2022 12:03:48 -0300 Subject: [PATCH 26/37] Showing a spinner now while processing --- DNN Platform/Modules/TelerikRemoval/View.ascx | 1 + .../Modules/TelerikRemoval/View.ascx.cs | 9 +++ .../Modules/TelerikRemoval/module.css | 66 +++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index 2693d0317a2..f66d4a542f9 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -5,6 +5,7 @@
+

diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs index d921ae15169..4e06a6069de 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -61,6 +61,7 @@ protected void Page_Load(object sender, EventArgs e) { this.InitMainMultiView(); this.InitRemoveTelerikButton(); + this.RegisterClientScripts(); } } @@ -202,6 +203,14 @@ private void InitRemoveTelerikButton() this.RemoveTelerikButton.Enabled = false; } + private void RegisterClientScripts() + { + this.Page.ClientScript.RegisterOnSubmitStatement( + typeof(View), + nameof(View), + "$('#telerikRemoval').addClass('running');"); + } + private T GetService() where T : class { diff --git a/DNN Platform/Modules/TelerikRemoval/module.css b/DNN Platform/Modules/TelerikRemoval/module.css index 54c50011b96..9b5caa4650c 100644 --- a/DNN Platform/Modules/TelerikRemoval/module.css +++ b/DNN Platform/Modules/TelerikRemoval/module.css @@ -19,3 +19,69 @@ #telerikRemoval td:nth-child(2), #telerikRemoval th:nth-child(2) { text-align: center; } + +#telerikRemoval:before { + background: rgba(255,255,255,0.8); + content: " "; + display: block; + height: 100%; + left: 0; + opacity: 0; + position: absolute; + top: 0; + transition: all .3s; + transition-timing-function: ease-in; + width: 99%; + z-index: -1; +} + +#telerikRemoval.running:before { + z-index: 4000; + opacity: 1; +} + +#telerikRemoval .loading { + animation: ld-spin 1s infinite linear; + box-sizing: content-box; + display: inline-block; + height: 1em; + left: 50%; + margin: -0.5em; + opacity: 0; + position: absolute; + top: 50%; + transform-origin: 50% 50%; + transition: all .1s; + transition-timing-function: ease-in; + width: 1em; + z-index: -1; +} + +#telerikRemoval .loading:after { + backface-visibility: hidden; + border-radius: 50%; + border: 0.3em solid currentColor; + border-left-color: transparent; + box-sizing: border-box; + content: " "; + display: block; + height: 2em; + transform-origin: 0 0; + transform: translateZ(0) scale(0.5); + width: 2em; +} + +#telerikRemoval.running .loading { + opacity: 1; + z-index: 4001; +} + +@keyframes ld-spin { + 0% { + animation-timing-function: cubic-bezier(0.5856,0.0703,0.4143,0.9297); + transform: rotate(0) + } + 100% { + transform: rotate(360deg) + } +} From af4d7ad3c78e8817685cef67e38207db6ed186d5 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Thu, 28 Apr 2022 15:26:37 -0300 Subject: [PATCH 27/37] Hooked Telerik removal to the upgrade process --- .../Dnn.Modules.TelerikRemoval.csproj | 4 + .../Modules/TelerikRemoval/TelerikRemoval.dnn | 12 ++- .../TelerikRemoval/UpgradeController.cs | 78 +++++++++++++++++++ .../Modules/TelerikRemoval/packages.config | 1 + .../UpgradeWizard.aspx.resx | 3 + .../Website/Install/UpgradeWizard.aspx.cs | 32 ++++++-- .../SqlDataProvider/09.11.00.SqlDataProvider | 11 +++ 7 files changed, 133 insertions(+), 8 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemoval/UpgradeController.cs diff --git a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj index f9b348f9e7c..8d9ca9d5250 100644 --- a/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj +++ b/DNN Platform/Modules/TelerikRemoval/Dnn.Modules.TelerikRemoval.csproj @@ -50,6 +50,9 @@ + + ..\..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + @@ -80,6 +83,7 @@ + diff --git a/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn index 38615beb9cd..6a0d04436fd 100644 --- a/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn +++ b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn @@ -2,9 +2,7 @@ Telerik Removal - - This module allows you to remove the DotNetNuke Telerik Web Components library from your site. - + This module allows you to remove the DotNetNuke Telerik Web Components library from your site. .NET Foundation and Contributors DNN Community @@ -63,6 +61,14 @@ + + DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke + UpgradeModule + + Dnn.Modules.TelerikRemoval.UpgradeController, Dnn.Modules.TelerikRemoval + upgrade + + diff --git a/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs b/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs new file mode 100644 index 00000000000..60051c7b6f9 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemoval +{ + using System; + + using Dnn.Modules.TelerikRemovalLibrary; + using DotNetNuke.Abstractions.Application; + using DotNetNuke.Common; + using DotNetNuke.Common.Extensions; + using DotNetNuke.Entities; + using DotNetNuke.Entities.Modules; + using DotNetNuke.Web; + + /// + /// An implementation. + /// + public class UpgradeController : IUpgradeable + { + /// + /// Key of the Telerik unintall option in the host settings. + /// + private static readonly string TelerikUninstallOptionSettingKey = "telerikUninstallOption"; + + private readonly IServiceProvider serviceProvider = GetServiceProvider(); + + /// + public string UpgradeModule(string version) + { + var option = this.GetHostSetting(TelerikUninstallOptionSettingKey); + + // we have read the value, and now we need to delete the setting + // to prevent this process from getting triggered if the user + // manually installs the extension. + // we can't use IApplicationStatusInfo.Status to detect whether + // this is an upgrade or a manual installation because this + // method is executed during Application startup, after the + // upgrade process has already finished. + this.DeleteHostSetting(TelerikUninstallOptionSettingKey); + + if ("Y".Equals(option, StringComparison.OrdinalIgnoreCase)) + { + this.GetService().Execute(); + } + + return "Success"; + } + + private static IServiceProvider GetServiceProvider() + { + return HttpContextSource.Current?.GetScope()?.ServiceProvider ?? + DependencyInjectionInitialize.BuildServiceProvider(); + } + + private string GetHostSetting(string key) + { + return this.GetService().GetString(key); + } + + private void DeleteHostSetting(string key, bool isSecure = false) + { + this.GetService().Update(new ConfigurationSetting + { + IsSecure = isSecure, + Key = key, + Value = null, + }); + } + + private T GetService() + where T : class + { + return (T)this.serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemoval/packages.config b/DNN Platform/Modules/TelerikRemoval/packages.config index a78dbbc47c8..2706dc50e56 100644 --- a/DNN Platform/Modules/TelerikRemoval/packages.config +++ b/DNN Platform/Modules/TelerikRemoval/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file diff --git a/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx b/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx index ce94b10175e..6fb507f3809 100644 --- a/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx +++ b/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx @@ -258,4 +258,7 @@ Invalid Telerik anti-forgery token. + + Telerik uninstall option is missing. + \ No newline at end of file diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs index 33427887121..495821f39c6 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs @@ -20,6 +20,7 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Application; using DotNetNuke.Common.Internal; using DotNetNuke.Common.Utilities; + using DotNetNuke.Entities; using DotNetNuke.Entities.Controllers; using DotNetNuke.Entities.Users; using DotNetNuke.Framework; @@ -185,16 +186,23 @@ public static Tuple GetSecurityTab(Dictionary accountInfo) { - if (!TelerikAntiForgeryTokenIsValid(accountInfo)) - { - throw new InvalidOperationException(LocalizeStringStatic("TelerikInvalidAntiForgeryToken")); - } - string errorMsg; var result = VerifyHostUser(accountInfo, out errorMsg); if (result == true) { + if (!TelerikAntiForgeryTokenIsValid(accountInfo)) + { + throw new InvalidOperationException(LocalizeStringStatic("TelerikInvalidAntiForgeryToken")); + } + + if (!accountInfo.ContainsKey(TelerikUninstallOptionClientID)) + { + throw new InvalidOperationException(LocalizeStringStatic("TelerikUnintallOptionMissing")); + } + + SetHostSetting(TelerikUninstallOptionClientID, accountInfo[TelerikUninstallOptionClientID]); + _upgradeRunning = false; LaunchUpgrade(); @@ -533,6 +541,20 @@ private static string GetHostSetting(string key) .GetSettingsDictionary()[key]; } + private static void SetHostSetting(string key, string value, bool isSecure = false) + { + var setting = new ConfigurationSetting + { + IsSecure = isSecure, + Key = key, + Value = value, + }; + + Globals.DependencyProvider + .GetRequiredService() + .Update(setting); + } + private static void GetInstallerLocales() { var filePath = Globals.ApplicationMapPath + LocalesFile.Replace("/", "\\"); diff --git a/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider b/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider index 6082400c277..5f66855923a 100644 --- a/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider +++ b/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider @@ -51,6 +51,17 @@ BEGIN END GO +/* Install the Telerik Removal extension */ +/************************************************************/ + +IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}Packages] WHERE [Name] = 'TelerikRemoval') + INSERT INTO {databaseOwner}[{objectQualifier}Packages] ( + [PortalID], [Name], [FriendlyName], [PackageType], [Version], [CreatedByUserID], [CreatedOnDate] + ) + VALUES ( + NULL, 'TelerikRemoval', 'Telerik Removal', 'Module', '9.11.0', -1, GETDATE() + ) +GO /************************************************************/ From 45f15f0203178d387484c93bd961cde2cb00059b Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Fri, 29 Apr 2022 11:53:23 -0300 Subject: [PATCH 28/37] Completed remaining localization --- .../App_LocalResources/View.ascx.resx | 84 +++++++++++++++++++ DNN Platform/Modules/TelerikRemoval/View.ascx | 6 +- .../TelerikRemoval/View.ascx.designer.cs | 27 ++++++ .../Dnn.Modules.TelerikRemovalLibrary.csproj | 2 + .../TelerikRemovalLibrary/ILocalizer.cs | 36 ++++++++ .../TelerikRemovalLibrary/Localizer.cs | 50 +++++++++++ .../Modules/TelerikRemovalLibrary/Startup.cs | 3 + .../Steps/ClearCacheStep.cs | 7 +- .../Steps/DeleteFilesStep.cs | 6 +- .../Steps/ExecuteSqlStep.cs | 7 +- .../Steps/InstallAvailablePackageStep.cs | 10 ++- .../Steps/RemoveExtensionStep.cs | 11 +-- .../Steps/RemoveItemFromCollectionStep.cs | 14 +++- .../RemoveTelerikBindingRedirectsStep.cs | 16 ++-- .../Steps/RemoveTelerikRewriterRulesStep.cs | 16 ++-- .../Steps/ReplacePortalTabModuleStep.cs | 12 +-- .../Steps/ReplaceTabModuleStep.cs | 9 +- .../Steps/StepArrayBase.cs | 5 +- .../TelerikRemovalLibrary/Steps/StepBase.cs | 30 ++++++- .../Steps/UninstallPackageStep.cs | 8 +- .../Steps/XmlStepBase.cs | 4 +- .../TelerikUninstaller.cs | 14 +++- 22 files changed, 320 insertions(+), 57 deletions(-) create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/ILocalizer.cs create mode 100644 DNN Platform/Modules/TelerikRemovalLibrary/Localizer.cs diff --git a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx index 83f79fc7250..8cc28b507ba 100644 --- a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx +++ b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx @@ -168,4 +168,88 @@ Remove Telerik Now + + Notes + + + Result + + + Step + + + Delete files '{0}' + + + Update provider for '{0}' in DataType list + + + Web.config: remove Telerik from {0} + + + Clean up dependency records for package '{0}' + + + Clear cache + + + {0} files deleted. + + + {0} matches found. + + + {0} records affected. + + + Install package '{0}' + + + Internal error. + + + '{0}' module not found in '{1}' page. + + + No matches found. + + + Package '{0}' was already installed. + + + Package '{0}' was already uninstalled. + + + Package file '{0}' was not found. + + + Page '{0}' not found in portal '{1}'. + + + Remove Telerik assembly binding redirects + + + Remove extension '{0}' + + + Remove Telerik URL rewrite rules + + + Remove the 'System' attribute from package '{0}' + + + Replace '{0}' with '{1}' in page '{2}' + + + Replace '{0}' with '{1}' in page '{2}', portal ID '{3}' + + + Following required properties are not set: {0} + + + {0} section not found. + + + Uninstall the '{0}' extension + \ No newline at end of file diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index f66d4a542f9..d0d1a9c0553 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -74,9 +74,9 @@ - - - + + + diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs index a2f9e37a3b6..0c191c4c6ac 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs @@ -239,6 +239,33 @@ public partial class View /// protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportDetailLabel; + /// + /// UninstallReportStepColumnLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportStepColumnLabel; + + /// + /// UninstallReportResultColumnLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportResultColumnLabel; + + /// + /// UninstallReportNotesColumnLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel UninstallReportNotesColumnLabel; + /// /// UninstallReportRepeater control. /// diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj index 024f0fb0898..9993fff36e8 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Dnn.Modules.TelerikRemovalLibrary.csproj @@ -53,7 +53,9 @@ + + diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/ILocalizer.cs b/DNN Platform/Modules/TelerikRemovalLibrary/ILocalizer.cs new file mode 100644 index 00000000000..07448b3e394 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/ILocalizer.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + /// + /// Utility interface to support simple localization. + /// + internal interface ILocalizer + { + /// + /// Looks for the specified key in the resources file and + /// returns the translated value if found, or null otherwise. + /// + /// The key to search for. + /// The localized string associated to the provided key. + string Localize(string key); + + /// + /// Looks for the specified key in the resources file. + /// If the key is found, it returns the translated value + /// after filling the placeholders in it with the supplied arguments. + /// If the key is not found, this method returns null. + /// + /// + /// The key to search for, which should yield a string with format placeholders in it. + /// + /// An array of arguments to fill the format placeholders with. + /// + /// The localized string associated with the provided key, + /// after filling all placeholders in it with the supplied arguments. + /// + string LocalizeFormat(string formatKey, params object[] args); + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Localizer.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Localizer.cs new file mode 100644 index 00000000000..836a73ee842 --- /dev/null +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Localizer.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.TelerikRemovalLibrary +{ + using System; + using System.Globalization; + + using DotNetNuke.Services.Localization; + + /// + /// Utility class to support simple localization. + /// + internal class Localizer : ILocalizer + { + /// + /// The relative path to the resources file for localization. + /// + public static readonly string ResourceFile = + "~/DesktopModules/TelerikRemoval/App_LocalResources/View.ascx.resx"; + + private readonly ILocalizationProvider localizationProvider; + + /// + /// Initializes a new instance of the class. + /// + /// An instance of . + public Localizer(ILocalizationProvider localizationProvider) + { + this.localizationProvider = localizationProvider ?? + throw new ArgumentNullException(nameof(localizationProvider)); + } + + /// + public string Localize(string key) + { + return this.localizationProvider.GetString(key, ResourceFile); + } + + /// + public string LocalizeFormat(string formatKey, params object[] args) + { + return string.Format( + CultureInfo.CurrentCulture, + this.Localize(formatKey), + args); + } + } +} diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs index af1c490b005..1ef872de8c7 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Startup.cs @@ -11,6 +11,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary using DotNetNuke.Entities.Tabs; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer.Packages; + using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; /// @@ -20,8 +21,10 @@ public class Startup : IDnnStartup public void ConfigureServices(IServiceCollection services) { services.AddTransient(); + services.AddTransient(); // core + services.AddTransient(provider => LocalizationProvider.Instance); services.AddTransient(provider => LoggerSource.Instance); services.AddTransient(provider => ModuleController.Instance); services.AddTransient(provider => PackageController.Instance); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs index 234686fcf35..aab3db46a6e 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ClearCacheStep.cs @@ -17,9 +17,10 @@ internal class ClearCacheStep : StepBase, IClearCacheStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public ClearCacheStep(ILoggerSource loggerSource, IDataCache dataCache) - : base(loggerSource) + public ClearCacheStep(ILoggerSource loggerSource, ILocalizer localizer, IDataCache dataCache) + : base(loggerSource, localizer) { this.dataCache = dataCache ?? throw new ArgumentNullException(nameof(dataCache)); @@ -28,7 +29,7 @@ public ClearCacheStep(ILoggerSource loggerSource, IDataCache dataCache) } /// - public override string Name => "Clear cache"; + public override string Name => this.Localize("UninstallStepClearCache"); /// protected override void ExecuteInternal() diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs index ae33f2ecc1c..a6384ed5d84 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/DeleteFilesStep.cs @@ -22,13 +22,15 @@ internal class DeleteFilesStep : StepBase, IDeleteFilesStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . /// An instance of . public DeleteFilesStep( ILoggerSource loggerSource, + ILocalizer localizer, IFileSystemProvider fileSystemProvider, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource) + : base(loggerSource, localizer) { this.fileSystemProvider = fileSystemProvider ?? throw new ArgumentNullException(nameof(fileSystemProvider)); @@ -64,7 +66,7 @@ protected override void ExecuteInternal() } this.Success = true; - this.Notes = $"{count} files deleted."; + this.Notes = this.LocalizeFormat("UninstallStepCountOfFilesDeleted", count); } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs index 4b0a663f3bf..cc5195107a0 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ExecuteSqlStep.cs @@ -18,9 +18,10 @@ internal class ExecuteSqlStep : StepBase, IExecuteSqlStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public ExecuteSqlStep(ILoggerSource loggerSource, IDataProvider dataProvider) - : base(loggerSource) + public ExecuteSqlStep(ILoggerSource loggerSource, ILocalizer localizer, IDataProvider dataProvider) + : base(loggerSource, localizer) { this.dataProvider = dataProvider ?? throw new ArgumentNullException(nameof(dataProvider)); @@ -37,7 +38,7 @@ public ExecuteSqlStep(ILoggerSource loggerSource, IDataProvider dataProvider) protected override void ExecuteInternal() { this.Result = this.dataProvider.ExecuteSQL(this.CommandText); - this.Notes = $"{this.Result.RecordsAffected} records affected."; + this.Notes = this.LocalizeFormat("UninstallStepCountOfRecordsAffected", this.Result.RecordsAffected); this.Success = true; } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs index a90a72a8b1c..56ba6820d9f 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/InstallAvailablePackageStep.cs @@ -25,15 +25,17 @@ internal class InstallAvailablePackageStep : StepBase, IInstallAvailablePackageS /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . public InstallAvailablePackageStep( ILoggerSource loggerSource, + ILocalizer localizer, IApplicationStatusInfo appStatusInfo, IFileSystemProvider fsProvider, IPackageController packageController) - : base(loggerSource) + : base(loggerSource, localizer) { this.appStatusInfo = appStatusInfo ?? throw new ArgumentNullException(nameof(appStatusInfo)); @@ -46,7 +48,7 @@ public InstallAvailablePackageStep( } /// - public override string Name => $"Install package '{this.PackageName}'"; + public override string Name => this.LocalizeFormat("UninstallStepInstallPackage", this.PackageName); /// [Required] @@ -66,7 +68,7 @@ protected override void ExecuteInternal() if (this.PackageIsAlreadyInstalled()) { this.Success = true; - this.Notes = $"Package '{this.PackageName}' was already installed."; + this.Notes = this.LocalizeFormat("UninstallStepPackageAlreadyInstalled", this.PackageName); return; } @@ -82,7 +84,7 @@ protected override void ExecuteInternal() if (filePath is null) { this.Success = false; - this.Notes = $"Package file '{this.PackageFileNamePattern}' was not found."; + this.Notes = this.LocalizeFormat("UninstallStepPackageNotFound", this.PackageFileNamePattern); return; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs index 76bf8f784cd..af9efa09411 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveExtensionStep.cs @@ -20,16 +20,17 @@ internal class RemoveExtensionStep : StepArrayBase, IRemoveExtensionStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public RemoveExtensionStep(ILoggerSource loggerSource, IServiceProvider serviceProvider) - : base(loggerSource) + public RemoveExtensionStep(ILoggerSource loggerSource, ILocalizer localizer, IServiceProvider serviceProvider) + : base(loggerSource, localizer) { this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); } /// - public override string Name => $"Remove extension '{this.PackageName}'"; + public override string Name => this.LocalizeFormat("UninstallStepRemoveExtension", this.PackageName); /// [Required] @@ -59,7 +60,7 @@ private IStep RemoveSystemAttributeFromPackage() "WHERE [Name] = '{0}'"); var step = this.GetService(); - step.Name = $"Remove the 'System' attribute from package '{this.PackageName}'"; + step.Name = this.LocalizeFormat("UninstallStepRemoveSystemAttribute", this.PackageName); step.CommandText = string.Format(commandFormat, this.PackageName); return step; @@ -87,7 +88,7 @@ private IStep DeleteDependencyRecords() "WHERE PackageName = '{0}'"); var step = this.GetService(); - step.Name = $"Clean up dependency records for package '{this.PackageName}'"; + step.Name = this.LocalizeFormat("UninstallStepCleanupDependencyRecords", this.PackageName); step.CommandText = string.Format(commandFormat, this.PackageName); return step; diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs index e7c4a82dc6d..2e10a136b4c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveItemFromCollectionStep.cs @@ -18,9 +18,13 @@ internal class RemoveItemFromCollectionStep : XmlStepBase, IRemoveItemFromCollec /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public RemoveItemFromCollectionStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, applicationStatusInfo) + public RemoveItemFromCollectionStep( + ILoggerSource loggerSource, + ILocalizer localizer, + IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, localizer, applicationStatusInfo) { } @@ -44,7 +48,7 @@ protected override void ProcessXml(XmlDocument doc) var collection = doc.SelectSingleNode(this.CollectionPath); if (collection is null) { - this.Notes = $"{this.CollectionPath} section not found."; + this.Notes = this.LocalizeFormat("UninstallStepSectionNotFound", this.CollectionPath); return; } @@ -62,7 +66,9 @@ protected override void ProcessXml(XmlDocument doc) matchCount++; }); - this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + this.Notes = matchCount > 0 + ? this.LocalizeFormat("UninstallStepCountOfMatchesFound", matchCount) + : this.Localize("UninstallStepNoMatchesFound"); } private string JoinAttributesToIncludeInSearch(XmlElement element) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs index 1b01e98caa8..d0b76862b4a 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikBindingRedirectsStep.cs @@ -18,14 +18,18 @@ internal class RemoveTelerikBindingRedirectsStep : XmlStepBase, IRemoveTelerikBi /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public RemoveTelerikBindingRedirectsStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, applicationStatusInfo) + public RemoveTelerikBindingRedirectsStep( + ILoggerSource loggerSource, + ILocalizer localizer, + IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, localizer, applicationStatusInfo) { } /// - public override string Name => "Remove Telerik assembly binding redirects"; + public override string Name => this.Localize("UninstallStepRemoveBindingRedirects"); /// [Required] @@ -47,7 +51,7 @@ protected override void ProcessXml(XmlDocument doc) var assemblyBinding = doc.SelectSingleNode(AssemblyBindingPath, this.NamespaceManager); if (assemblyBinding is null) { - this.Notes = $"{AssemblyBindingPath} section not found."; + this.Notes = this.LocalizeFormat("UninstallStepSectionNotFound", AssemblyBindingPath); return; } @@ -71,7 +75,9 @@ protected override void ProcessXml(XmlDocument doc) matchCount++; }); - this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + this.Notes = matchCount > 0 + ? this.LocalizeFormat("UninstallStepCountOfMatchesFound", matchCount) + : this.Localize("UninstallStepNoMatchesFound"); } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs index 8287581c7dd..6e8e08722f7 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/RemoveTelerikRewriterRulesStep.cs @@ -18,14 +18,18 @@ internal class RemoveTelerikRewriterRulesStep : XmlStepBase, IRemoveTelerikRewri /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public RemoveTelerikRewriterRulesStep(ILoggerSource loggerSource, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, applicationStatusInfo) + public RemoveTelerikRewriterRulesStep( + ILoggerSource loggerSource, + ILocalizer localizer, + IApplicationStatusInfo applicationStatusInfo) + : base(loggerSource, localizer, applicationStatusInfo) { } /// - public override string Name => "Remove Telerik URL rewrite rules"; + public override string Name => this.Localize("UninstallStepRemoveRewriteRules"); /// [Required] @@ -41,7 +45,7 @@ protected override void ProcessXml(XmlDocument doc) var rules = doc.SelectSingleNode(RulesPath); if (rules is null) { - this.Notes = $"{RulesPath} section not found."; + this.Notes = this.LocalizeFormat("UninstallStepSectionNotFound", RulesPath); return; } @@ -60,7 +64,9 @@ protected override void ProcessXml(XmlDocument doc) matchCount++; }); - this.Notes = matchCount > 0 ? $"{matchCount} matches found." : "No matches found."; + this.Notes = matchCount > 0 + ? this.LocalizeFormat("UninstallStepCountOfMatchesFound", matchCount) + : this.Localize("UninstallStepNoMatchesFound"); } } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs index 54ba54597d5..62c3caa8403 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplacePortalTabModuleStep.cs @@ -24,17 +24,19 @@ internal class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleSte /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// An instance of . public ReplacePortalTabModuleStep( ILoggerSource loggerSource, + ILocalizer localizer, IModuleController moduleController, ITabController tabController, IDesktopModuleController desktopModuleController, IModuleDefinitionController moduleDefinitionController) - : base(loggerSource) + : base(loggerSource, localizer) { this.moduleController = moduleController ?? throw new ArgumentNullException(nameof(moduleController)); @@ -50,8 +52,8 @@ public ReplacePortalTabModuleStep( } /// - public override string Name => string.Format( - "Replace '{0}' with '{1}' in page '{2}', portal ID '{3}'", + public override string Name => this.LocalizeFormat( + "UninstallStepReplacePortalPageModule", this.OldModuleName, this.NewModuleName, this.PageName, @@ -79,7 +81,7 @@ protected override void ExecuteInternal() if (tab is null) { this.Success = true; - this.Notes = $"Page '{this.PageName}' not found in portal '{this.PortalId}'."; + this.Notes = this.LocalizeFormat("UninstallStepPageNotFoundInPortal", this.PageName, this.PortalId); return; } @@ -90,7 +92,7 @@ protected override void ExecuteInternal() if (!modules.Any()) { this.Success = true; - this.Notes = $"'{this.OldModuleName}' module not found in '{this.PageName}' page."; + this.Notes = this.LocalizeFormat("UninstallStepModuleNotFoundInPage", this.OldModuleName, this.PageName); } foreach (var module in modules) diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs index 5c71a27bc90..0170e720808 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/ReplaceTabModuleStep.cs @@ -22,9 +22,10 @@ internal partial class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, I /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . - public ReplaceTabModuleStep(ILoggerSource loggerSource, IServiceProvider serviceProvider) - : base(loggerSource) + public ReplaceTabModuleStep(ILoggerSource loggerSource, ILocalizer localizer, IServiceProvider serviceProvider) + : base(loggerSource, localizer) { this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); @@ -33,8 +34,8 @@ public ReplaceTabModuleStep(ILoggerSource loggerSource, IServiceProvider service } /// - public override string Name => string.Format( - "Replace '{0}' with '{1}' in page '{2}'", + public override string Name => this.LocalizeFormat( + "UninstallStepReplacePageModule", this.OldModuleName, this.NewModuleName, this.PageName); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs index f4de324392b..d9256774794 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepArrayBase.cs @@ -17,8 +17,9 @@ internal abstract class StepArrayBase : StepBase, IStepArray /// Initializes a new instance of the class. /// /// An instance of . - public StepArrayBase(ILoggerSource loggerSource) - : base(loggerSource) + /// An instance of . + public StepArrayBase(ILoggerSource loggerSource, ILocalizer localizer) + : base(loggerSource, localizer) { } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs index 7a148ff966d..3de6c11fa59 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/StepBase.cs @@ -5,6 +5,7 @@ namespace Dnn.Modules.TelerikRemovalLibrary { using System; + using System.Globalization; using System.Linq; using DotNetNuke.Instrumentation; @@ -14,11 +15,14 @@ namespace Dnn.Modules.TelerikRemovalLibrary /// internal abstract class StepBase : IStep { + private readonly ILocalizer localizer; + /// /// Initializes a new instance of the class. /// /// An instance of . - public StepBase(ILoggerSource loggerSource) + /// An instance of . + public StepBase(ILoggerSource loggerSource, ILocalizer localizer) { if (loggerSource is null) { @@ -26,6 +30,9 @@ public StepBase(ILoggerSource loggerSource) } this.Log = loggerSource.GetLogger(this.GetType()); + + this.localizer = localizer ?? + throw new ArgumentNullException(nameof(localizer)); } /// @@ -57,7 +64,7 @@ public void Execute() { this.Log.Error(ex); this.Success = false; - this.Notes = "Internal error."; + this.Notes = this.Localize("UninstallStepInternalError"); } } @@ -66,6 +73,21 @@ public void Execute() /// protected abstract void ExecuteInternal(); + /// + protected virtual string Localize(string key) + { + return this.localizer.Localize(key); + } + + /// + protected virtual string LocalizeFormat(string key, params object[] args) + { + return string.Format( + CultureInfo.CurrentCulture, + this.Localize(key), + args); + } + private void CheckRequired() { var nullProperties = this.GetType().GetProperties() @@ -76,8 +98,8 @@ private void CheckRequired() if (nullProperties.Length > 0) { - throw new InvalidOperationException(string.Format( - "Following required properties are not set: {0}", + throw new InvalidOperationException(this.LocalizeFormat( + "UninstallStepRequiredPropertiesNotSet", string.Join(", ", nullProperties))); } } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs index f0edb630c9d..eca14f58d7c 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/UninstallPackageStep.cs @@ -23,15 +23,17 @@ internal class UninstallPackageStep : StepBase, IUninstallPackageStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// A function that returns an instance of . public UninstallPackageStep( ILoggerSource loggerSource, + ILocalizer localizer, IPackageController packageController, IApplicationStatusInfo applicationStatusInfo, Func installerFactory) - : base(loggerSource) + : base(loggerSource, localizer) { this.packageController = packageController ?? throw new ArgumentNullException(nameof(packageController)); @@ -44,7 +46,7 @@ public UninstallPackageStep( } /// - public override string Name => $"Uninstall the '{this.PackageName}' extension"; + public override string Name => this.LocalizeFormat("UninstallStepUninstallExtension", this.PackageName); /// public bool DeleteFiles { get; set; } @@ -66,7 +68,7 @@ bool WithMatchingName(PackageInfo p) => if (packageInfo == default) { this.Success = true; - this.Notes = $"Package '{this.PackageName}' was already uninstalled."; + this.Notes = this.LocalizeFormat("UninstallStepPackageAlreadyUninstalled", this.PackageName); return; } diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs index 9d83065b6f5..4cc7dcc5e14 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/Steps/XmlStepBase.cs @@ -20,11 +20,13 @@ internal abstract class XmlStepBase : StepBase, IXmlStep /// Initializes a new instance of the class. /// /// An instance of . + /// An instance of . /// An instance of . public XmlStepBase( ILoggerSource loggerSource, + ILocalizer localizer, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource) + : base(loggerSource, localizer) { this.applicationStatusInfo = applicationStatusInfo ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); diff --git a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs index 7fa850a5b9e..e4ee1f749ce 100644 --- a/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs +++ b/DNN Platform/Modules/TelerikRemovalLibrary/TelerikUninstaller.cs @@ -14,17 +14,22 @@ namespace Dnn.Modules.TelerikRemovalLibrary internal class TelerikUninstaller : ITelerikUninstaller { private readonly IServiceProvider serviceProvider; + private readonly ILocalizer localizer; private readonly List progress; /// /// Initializes a new instance of the class. /// /// An instance of . - public TelerikUninstaller(IServiceProvider serviceProvider) + /// An instance of . + public TelerikUninstaller(IServiceProvider serviceProvider, ILocalizer localizer) { this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); + this.localizer = localizer ?? + throw new ArgumentNullException(nameof(localizer)); + this.progress = new List(); } @@ -129,7 +134,7 @@ private IStep UpdateDataTypeList(string value) "WHERE ListName = 'DataType' AND Value = '{0}'"); var step = this.GetService(); - step.Name = $"Update provider for '{value}' in DataType list"; + step.Name = this.localizer.LocalizeFormat("UninstallStepUpdateDataTypeListFormat", value); step.CommandText = string.Format(commandFormat, value); return step; } @@ -142,7 +147,7 @@ private IStep UpdateSiteUrlsConfig() private IStep UpdateWebConfig(string collectionPath, string attributeNames) { var step = this.GetService(); - step.Name = $"Web.config: remove Telerik from {collectionPath}"; + step.Name = this.localizer.LocalizeFormat("UninstallStepUpdateWebConfigFormat", collectionPath); step.RelativeFilePath = "Web.config"; step.CollectionPath = collectionPath; step.AttributeNamesToIncludeInSearch = attributeNames; @@ -158,7 +163,8 @@ private IStep RemoveTelerikBindingRedirects() private IStep RemoveUninstalledExtensionFiles(string relativePath, string searchPattern, bool recurse = false) { var step = this.GetService(); - step.Name = $"Delete files '{relativePath}/{searchPattern}'"; + step.Name = this.localizer.LocalizeFormat( + "UninstallStepCleanupExtensionFilesFormat", $"{relativePath}/{searchPattern}"); step.RelativePath = relativePath; step.SearchPattern = searchPattern; step.SearchOption = recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; From 6cfd2a4e1908d01c8e2aa23a6830a72900bb9bac Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Fri, 29 Apr 2022 17:54:23 -0300 Subject: [PATCH 29/37] Showing detected Telerik version number --- .../Library/Common/Utilities/ITelerikUtils.cs | 13 +++++++++++++ .../Library/Common/Utilities/TelerikUtils.cs | 19 +++++++++++++++++++ .../App_LocalResources/View.ascx.resx | 2 +- DNN Platform/Modules/TelerikRemoval/View.ascx | 2 ++ .../Modules/TelerikRemoval/View.ascx.cs | 4 ++++ .../TelerikRemoval/View.ascx.designer.cs | 18 ++++++++++++++++++ .../Modules/TelerikRemoval/module.css | 5 +++++ 7 files changed, 62 insertions(+), 1 deletion(-) diff --git a/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs b/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs index 63b19947666..79529dfb44e 100644 --- a/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs +++ b/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs @@ -4,7 +4,9 @@ namespace DotNetNuke.Common.Internal { + using System; using System.Collections.Generic; + using System.IO; /// /// Abstraction of Telerik related utilities. @@ -27,5 +29,16 @@ public interface ITelerikUtils /// /// True if Telerik is found in this site, or False otherwise. bool TelerikIsInstalled(); + + /// + /// Loads the Telerik assembly and returns its version number. + /// + /// The Telerik version number. + /// + /// An error occurred while loading the Telerik assembly. + /// The file may not exist, or it may be locked by another process. + /// The property contains the cause of the error. + /// + Version GetTelerikVersion(); } } diff --git a/DNN Platform/Library/Common/Utilities/TelerikUtils.cs b/DNN Platform/Library/Common/Utilities/TelerikUtils.cs index 641ce699f77..f4ba5d36a39 100644 --- a/DNN Platform/Library/Common/Utilities/TelerikUtils.cs +++ b/DNN Platform/Library/Common/Utilities/TelerikUtils.cs @@ -84,6 +84,25 @@ public bool TelerikIsInstalled() return this.FileExists(Path.Combine(this.BinPath, TelerikWebUIFileName)); } + /// + public Version GetTelerikVersion() + { + var domain = AppDomain.CreateDomain(nameof(TelerikUtils)); + try + { + var path = Path.Combine(this.BinPath, TelerikWebUIFileName); + return domain.Load(File.ReadAllBytes(path)).GetName().Version; + } + catch (Exception ex) + { + throw new IOException("Could not get Telerik version number.", ex); + } + finally + { + AppDomain.Unload(domain); + } + } + private bool AssemblyDependsOnTelerik(string path, AppDomain domain) { return this.GetReferencedAssemblyNames(path, domain) diff --git a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx index 8cc28b507ba..16caffab84c 100644 --- a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx +++ b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx @@ -130,7 +130,7 @@ Security Alert - We have detected the presence of the previously distributed Telerik developer components. + We have detected the presence of the previously distributed Telerik developer components. Detected Telerik version is: A Security Bulletin was released in August of 2021 that recommends immediate removal of this component due to the high-level security vulnerabilities present. You can read more about this on the <a href="https://dnncommunity.org/security" target="_blank">DNN Security Center</a>. diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index d0d1a9c0553..1d690f1c64f 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -29,6 +29,7 @@

TelerikInstalledDetected +

TelerikInstalledBulletin @@ -49,6 +50,7 @@

TelerikInstalledDetected +

TelerikInstalledBulletin diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs index 4e06a6069de..0786a9a7d85 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -183,15 +183,19 @@ private void InitMainMultiView() return; } + var version = telerikUtils.GetTelerikVersion().ToString(); + var assemblies = telerikUtils.GetAssembliesThatDependOnTelerik() .Select(a => Path.GetFileName(a)); if (!assemblies.Any()) { + this.TelerikInstalledButNotUsedVersionLabel.Text = version; this.MainMultiView.ActiveViewIndex = 2; // InstalledButNotUsedView return; } + this.TelerikInstalledAndUsedVersionLabel.Text = version; this.MainMultiView.ActiveViewIndex = 3; // InstalledAndUsedView var table = CreateTable(assemblies, maxRows: 3, maxColumns: 3); diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs index 0c191c4c6ac..642ad79140d 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs @@ -113,6 +113,15 @@ public partial class View /// protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedDetectedLabel; + ///

+ /// TelerikInstalledButNotUsedVersionLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedVersionLabel; + /// /// TelerikInstalledButNotUsedBulletinLabel control. /// @@ -176,6 +185,15 @@ public partial class View /// protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedDetectedLabel; + /// + /// TelerikInstalledAndUsedVersionLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedVersionLabel; + /// /// TelerikInstalledAndUsedBulletinLabel control. /// diff --git a/DNN Platform/Modules/TelerikRemoval/module.css b/DNN Platform/Modules/TelerikRemoval/module.css index 9b5caa4650c..e21d3691304 100644 --- a/DNN Platform/Modules/TelerikRemoval/module.css +++ b/DNN Platform/Modules/TelerikRemoval/module.css @@ -12,6 +12,11 @@ border-bottom: 1px solid lightgray; } +#telerikRemoval .telerikVersion { + font-weight: bold; + color: #ec3d46; +} + #uninstallReport th { font-size: initial; } From 6589b3a73851cd0a335ebf3e40a710f24747bb68 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Sat, 30 Apr 2022 18:14:04 -0300 Subject: [PATCH 30/37] Minor fixes --- DNN Platform/Modules/TelerikRemoval/View.ascx | 9 ++++++--- DNN Platform/Modules/TelerikRemoval/View.ascx.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index 1d690f1c64f..3f89b394179 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -76,9 +76,12 @@
StepResultNotesUninstallReportStepColumnUninstallReportResultColumnUninstallReportNotesColumn
- - - + + + diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs index 0786a9a7d85..40a1939f61f 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -33,7 +33,7 @@ public View() /// /// Initializes a new instance of the class. /// - /// An instance of . + /// An instance of . internal View(IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider ?? From dc54f67f17d8c044889c0610706ec9750af4a939 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Sat, 30 Apr 2022 18:17:21 -0300 Subject: [PATCH 31/37] Moved in-line style to CSS file --- DNN Platform/Modules/TelerikRemoval/View.ascx | 2 +- DNN Platform/Modules/TelerikRemoval/module.css | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index 3f89b394179..dc0a0e792f1 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -5,7 +5,7 @@
-
+

diff --git a/DNN Platform/Modules/TelerikRemoval/module.css b/DNN Platform/Modules/TelerikRemoval/module.css index e21d3691304..9e26eb26735 100644 --- a/DNN Platform/Modules/TelerikRemoval/module.css +++ b/DNN Platform/Modules/TelerikRemoval/module.css @@ -48,7 +48,9 @@ #telerikRemoval .loading { animation: ld-spin 1s infinite linear; box-sizing: content-box; + color: #21a3da; display: inline-block; + font-size: 3em; height: 1em; left: 50%; margin: -0.5em; From 2fbfba28cde5f4361c11cf1f9103c956c2046a03 Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Sun, 1 May 2022 19:35:02 -0300 Subject: [PATCH 32/37] Updated InstalledAndUsed view to handle DAM case --- .../Library/Common/Utilities/ITelerikUtils.cs | 6 ++ .../Library/Common/Utilities/TelerikUtils.cs | 11 ++++ .../App_LocalResources/View.ascx.resx | 14 +++-- DNN Platform/Modules/TelerikRemoval/View.ascx | 60 +++++++++---------- .../Modules/TelerikRemoval/View.ascx.cs | 15 +++-- .../TelerikRemoval/View.ascx.designer.cs | 54 ++++++----------- .../Modules/TelerikRemoval/module.css | 2 +- 7 files changed, 83 insertions(+), 79 deletions(-) diff --git a/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs b/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs index 79529dfb44e..ff094bba3b0 100644 --- a/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs +++ b/DNN Platform/Library/Common/Utilities/ITelerikUtils.cs @@ -18,6 +18,12 @@ public interface ITelerikUtils /// string BinPath { get; } + /// + /// Checks whether the Digital Asset Management extension is installed on this site. + /// + /// True if Digital Asset Management is found, or False otherwise. + bool DigitalAssetsIsInstalled(); + /// /// Gets an containing all assemblies that depend on Telerik. /// diff --git a/DNN Platform/Library/Common/Utilities/TelerikUtils.cs b/DNN Platform/Library/Common/Utilities/TelerikUtils.cs index f4ba5d36a39..a6bb1273636 100644 --- a/DNN Platform/Library/Common/Utilities/TelerikUtils.cs +++ b/DNN Platform/Library/Common/Utilities/TelerikUtils.cs @@ -21,6 +21,11 @@ public class TelerikUtils : ITelerikUtils /// public static readonly string TelerikWebUIFileName = "Telerik.Web.UI.dll"; + /// + /// The file name of the Digital Asset Management assembly. + /// + public static readonly string DigitalAssetsFileName = "DotNetNuke.Modules.DigitalAssets.dll"; + private static readonly string[] Vendors = new[] { "Microsoft", @@ -60,6 +65,12 @@ internal TelerikUtils(IApplicationStatusInfo applicationStatusInfo) /// public string BinPath => Path.Combine(this.applicationStatusInfo.ApplicationMapPath, "bin"); + /// + public bool DigitalAssetsIsInstalled() + { + return this.FileExists(Path.Combine(this.BinPath, DigitalAssetsFileName)); + } + /// public IEnumerable GetAssembliesThatDependOnTelerik() { diff --git a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx index 16caffab84c..8e751694e48 100644 --- a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx +++ b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx @@ -117,11 +117,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - It is not possible to automatically remove Telerik on your installation due to the following extensions: + + Your installation is utilizing Telerik in the following assemblies (including the <strong>Digital Asset Management</strong> module): - - Starting with DNN 10.0.0, it will be mandatory to remove Telerik. Please update or replace the above extensions ASAP and then follow the <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">manual Telerik removal steps</a>. + + Your installation is utilizing Telerik in the following assemblies: + + + There are known security issues with the DNN Distributed version of Telerik and the usage of Telerik by DNN modules, such as <strong>Digital Asset Management</strong>. If you have otherwise complied with Telerik security patching via other means, you should at a minimum uninstall Digital Asset Management and replace it with the newer <strong>Resource Manager</strong> module. However, if you have not made any security adjustments, the modules listed above should be updated/replaced and then Telerik removed to ensure proper security of your installation. + + + It appears that you have removed a portion of the DNN Platform extensions that depended on Telerik, but we are unable to remove the dependencies listed above for you. However, please ensure that you have in fact properly patched Telerik and removed all DNN Platform distributed Telerik components per the guidance found <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">here</a>. Since your installation does NOT appear to be utilizing any of these components, you should remove them now to improve the security of your application. diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx b/DNN Platform/Modules/TelerikRemoval/View.ascx index dc0a0e792f1..78ceae71402 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx @@ -23,47 +23,41 @@ TelerikNotInstalledInfo

- +

TelerikInstalledHeading

- TelerikInstalledDetected - + TelerikInstalledDetected +

TelerikInstalledBulletin

-

- TelerikInstalledButNotUsedInfo -

-

- -

-
- -
-
- -

- TelerikInstalledHeading -

-

- TelerikInstalledDetected - -

-

- TelerikInstalledBulletin -

-

- TelerikInstalledAndUsedInfo -

-
- -
-

- TelerikInstalledAndUsedWarning -

+ + +

+ TelerikInstalledButNotUsedInfo +

+

+ +

+
+ +
+
+ +

+ +

+
+ +
+

+ +

+
+

diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs index 40a1939f61f..f138300d005 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.cs @@ -83,7 +83,7 @@ protected void RemoveTelerikButton_Click(object sender, EventArgs e) this.UninstallReportRepeater.DataSource = uninstaller.Progress; - this.MainMultiView.ActiveViewIndex = 4; // UninstallReportView + this.MainMultiView.ActiveViewIndex = 3; // UninstallReportView this.DataBind(); } @@ -183,20 +183,25 @@ private void InitMainMultiView() return; } + this.MainMultiView.ActiveViewIndex = 2; // InstalledView + var version = telerikUtils.GetTelerikVersion().ToString(); + this.TelerikInstalledVersionLabel.Text = version; var assemblies = telerikUtils.GetAssembliesThatDependOnTelerik() .Select(a => Path.GetFileName(a)); if (!assemblies.Any()) { - this.TelerikInstalledButNotUsedVersionLabel.Text = version; - this.MainMultiView.ActiveViewIndex = 2; // InstalledButNotUsedView + this.InstalledMultiView.ActiveViewIndex = 0; // InstalledButNotUsedView return; } - this.TelerikInstalledAndUsedVersionLabel.Text = version; - this.MainMultiView.ActiveViewIndex = 3; // InstalledAndUsedView + this.InstalledMultiView.ActiveViewIndex = 1; // InstalledAndUsedView + + var damPresentOrRemoved = telerikUtils.DigitalAssetsIsInstalled() ? "DamPresent" : "DamRemoved"; + this.TelerikInstalledAndUsedInfoLabel.Text = $"TelerikInstalledAndUsed{damPresentOrRemoved}Info"; + this.TelerikInstalledAndUsedWarningLabel.Text = $"TelerikInstalledAndUsed{damPresentOrRemoved}Warning"; var table = CreateTable(assemblies, maxRows: 3, maxColumns: 3); this.AssemblyListPlaceHolder.Controls.Add(table); diff --git a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs index 642ad79140d..89a5df34a15 100644 --- a/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs +++ b/DNN Platform/Modules/TelerikRemoval/View.ascx.designer.cs @@ -87,13 +87,13 @@ public partial class View protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikNotInstalledInfoLabel; /// - /// InstalledButNotUsedView control. + /// InstalledView control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.View InstalledButNotUsedView; + protected global::System.Web.UI.WebControls.View InstalledView; /// /// TelerikInstalledButNotUsedHeadingLabel control. @@ -105,22 +105,22 @@ public partial class View protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedHeadingLabel; /// - /// TelerikInstalledButNotUsedDetectedLabel control. + /// TelerikInstalledDetectedLabel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedDetectedLabel; + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledDetectedLabel; /// - /// TelerikInstalledButNotUsedVersionLabel control. + /// TelerikInstalledVersionLabel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedVersionLabel; + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledVersionLabel; /// /// TelerikInstalledButNotUsedBulletinLabel control. @@ -132,76 +132,58 @@ public partial class View protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedBulletinLabel; /// - /// TelerikInstalledButNotUsedInfoLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedInfoLabel; - - /// - /// BackupConfirmationCheckBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnCheckBox BackupConfirmationCheckBox; - - /// - /// RemoveTelerikButton control. + /// InstalledMultiView control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnTextButton RemoveTelerikButton; + protected global::System.Web.UI.WebControls.MultiView InstalledMultiView; /// - /// InstalledAndUsedView control. + /// InstalledButNotUsedView control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.View InstalledAndUsedView; + protected global::System.Web.UI.WebControls.View InstalledButNotUsedView; /// - /// TelerikInstalledAndUsedHeadingLabel control. + /// TelerikInstalledButNotUsedInfoLabel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedHeadingLabel; + protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledButNotUsedInfoLabel; /// - /// TelerikInstalledAndUsedDetectedLabel control. + /// BackupConfirmationCheckBox control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedDetectedLabel; + protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnCheckBox BackupConfirmationCheckBox; /// - /// TelerikInstalledAndUsedVersionLabel control. + /// RemoveTelerikButton control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedVersionLabel; + protected global::Dnn.Modules.TelerikRemoval.UserControls.DnnTextButton RemoveTelerikButton; /// - /// TelerikInstalledAndUsedBulletinLabel control. + /// InstalledAndUsedView control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnLabel TelerikInstalledAndUsedBulletinLabel; + protected global::System.Web.UI.WebControls.View InstalledAndUsedView; /// /// TelerikInstalledAndUsedInfoLabel control. diff --git a/DNN Platform/Modules/TelerikRemoval/module.css b/DNN Platform/Modules/TelerikRemoval/module.css index 9e26eb26735..c1351858327 100644 --- a/DNN Platform/Modules/TelerikRemoval/module.css +++ b/DNN Platform/Modules/TelerikRemoval/module.css @@ -6,7 +6,7 @@ width: 100%; } -#telerikRemoval td, #telerikRemoval th { +#uninstallReport td, #uninstallReport th { padding: 12px; border-top: 1px solid lightgray; border-bottom: 1px solid lightgray; From 0557262f2a7edd8ed355f4bd05392ca274cfc08f Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Sun, 1 May 2022 21:46:43 -0300 Subject: [PATCH 33/37] Updated UpgradeWizard to latest wording --- .../UpgradeWizard.aspx.resx | 16 ++++--- DNN Platform/Website/Install/Install.css | 6 ++- .../Website/Install/UpgradeWizard.aspx.cs | 45 ++++++++++++++----- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx b/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx index 6fb507f3809..23563184b2b 100644 --- a/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx +++ b/DNN Platform/Website/Install/App_LocalResources/UpgradeWizard.aspx.resx @@ -222,11 +222,17 @@ Security - - It is not possible to automatically remove Telerik on your installation due to the following extensions: + + Your installation is utilizing Telerik in the following assemblies (including the <strong>Digital Asset Management</strong> module): - - Starting with DNN 10.0.0, it will be mandatory to remove Telerik. Please update or replace the above extensions ASAP and then follow the <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">manual Telerik removal steps</a>. + + Your installation is utilizing Telerik in the following assemblies: + + + There are known security issues with the DNN Distributed version of Telerik and the usage of Telerik by DNN modules, such as <strong>Digital Asset Management</strong>. If you have otherwise complied with Telerik security patching via other means, you should at a minimum uninstall Digital Asset Management and replace it with the newer <strong>Resource Manager</strong> module. However, if you have not made any security adjustments, the modules listed above should be updated/replaced and then Telerik removed to ensure proper security of your installation. + + + It appears that you have removed a portion of the DNN Platform extensions that depended on Telerik, but we are unable to remove the dependencies listed above for you. However, please ensure that you have in fact properly patched Telerik and removed all DNN Platform distributed Telerik components per the guidance found <a href="https://docs.dnncommunity.org/content/getting-started/setup/telerik-removal/index.html" target="_blank">here</a>. Since your installation does NOT appear to be utilizing any of these components, you may elect to have them removed as part of this upgrade to improve the security of your application. @@ -235,7 +241,7 @@ Security Alert - We have detected the presence of the previously distributed Telerik developer components. + We have detected the presence of the previously distributed Telerik developer components. Detected Telerik version is: A Security Bulletin was released in August of 2021 that recommends immediate removal of this component due to the high-level security vulnerabilities present. You can read more about this on the <a href="https://dnncommunity.org/security" target="_blank">DNN Security Center</a>. diff --git a/DNN Platform/Website/Install/Install.css b/DNN Platform/Website/Install/Install.css index 6dee73bfc9f..b0baf502900 100644 --- a/DNN Platform/Website/Install/Install.css +++ b/DNN Platform/Website/Install/Install.css @@ -331,4 +331,8 @@ a.videoLink:hover { border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid red; -} \ No newline at end of file +} + +.telerikVersion { + font-weight: bold; +} diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs index 495821f39c6..8f1dbb13d6b 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs @@ -167,20 +167,25 @@ public static Tuple GetSecurityTab(Dictionary Path.GetFileName(a)); + + if (!assemblies.Any()) { return Tuple.Create( true, default(string), - GetTelerikInstalledAndUsedResult(assemblies)); + GetTelerikInstalledButNotUsedResult(version)); } + var damPresent = telerikUtils.DigitalAssetsIsInstalled(); + return Tuple.Create( true, default(string), - GetTelerikInstalledButNotUsedResult()); + GetTelerikInstalledAndUsedResult(assemblies, version, damPresent)); } [WebMethod] @@ -341,7 +346,7 @@ private static SecurityTabResult GetTelerikNotInstalledResult() }; } - private static SecurityTabResult GetTelerikInstalledButNotUsedResult() + private static SecurityTabResult GetTelerikInstalledButNotUsedResult(string version) { var yesButton = new ListItem(LocalizeStringStatic("TelerikUninstallYes"), OptionYes); var noButton = new ListItem(LocalizeStringStatic("TelerikUninstallNo"), OptionNo); @@ -351,7 +356,7 @@ private static SecurityTabResult GetTelerikInstalledButNotUsedResult() CanProceed = false, View = RenderControls( CreateTelerikAntiForgeryTokenField(), - CreateTelerikInstalledHeader(), + CreateTelerikInstalledHeader(version), CreateParagraph("TelerikInstalledButNotUsedInfo"), CreateParagraph("TelerikUninstallInfo"), new RadioButtonList @@ -362,17 +367,20 @@ private static SecurityTabResult GetTelerikInstalledButNotUsedResult() }; } - private static SecurityTabResult GetTelerikInstalledAndUsedResult(IEnumerable assemblies) + private static SecurityTabResult GetTelerikInstalledAndUsedResult( + IEnumerable assemblies, string version, bool damPresent) { + var damPresentOrRemoved = damPresent ? "DamPresent" : "DamRemoved"; + return new SecurityTabResult { CanProceed = true, View = RenderControls( CreateTelerikAntiForgeryTokenField(), - CreateTelerikInstalledHeader(), - CreateParagraph("TelerikInstalledAndUsedInfo"), + CreateTelerikInstalledHeader(version), + CreateParagraph($"TelerikInstalledAndUsed{damPresentOrRemoved}Info"), CreateTable(assemblies, maxRows: 3, maxColumns: 4), - CreateParagraph("TelerikInstalledAndUsedWarning")), + CreateParagraph($"TelerikInstalledAndUsed{damPresentOrRemoved}Warning")), }; } @@ -385,14 +393,27 @@ private static Control CreateTelerikAntiForgeryTokenField() }; } - private static Control CreateTelerikInstalledHeader() + private static Control CreateTelerikInstalledHeader(string version) { return CreateBundle( CreateHeading("TelerikInstalledHeading"), - CreateParagraph("TelerikInstalledDetected"), + CreateTelerikInstalledDetectedParagraph(version), CreateParagraph("TelerikInstalledBulletin")); } + private static Control CreateTelerikInstalledDetectedParagraph(string version) + { + return new HtmlGenericControl("p") + { + Controls = + { + new Label { Text = LocalizeStringStatic("TelerikInstalledDetected") }, + new Literal { Text = " " }, + new Label { Text = version, CssClass = "telerikVersion" }, + }, + }; + } + private static Control CreateBundle(params Control[] controls) { var bundle = new PlaceHolder(); From 26ee373cd1dd9561579c2b5c6a45934d94faf62c Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Sun, 1 May 2022 22:42:12 -0300 Subject: [PATCH 34/37] Fixed missing Telerik uninstall option in some views --- .../Website/Install/UpgradeWizard.aspx | 3 ++- .../Website/Install/UpgradeWizard.aspx.cs | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx b/DNN Platform/Website/Install/UpgradeWizard.aspx index dc13c036f3e..5dd131dcd6f 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx @@ -172,7 +172,6 @@ $('#<%= lblSecurityError.ClientID %>').text(''); $('#upgradeSecurityView').html(result.Item3.View); $('input[name="<%= TelerikUninstallOptionClientID %>"').click(function () { - upgradeWizard.accountInfo["<%= TelerikUninstallOptionClientID %>"] = $(this).val(); enable("#<%= UpgradeNowButton.ClientID %>"); }); if (result.Item3.CanProceed) { @@ -331,6 +330,8 @@ $('#<%= UpgradeNowButton.ClientID %>').click(function () { if (!$(this).hasClass('dnnDisabledAction')) { + var option = $('input[name="<%= TelerikUninstallOptionClientID %>"').val(); + upgradeWizard.accountInfo["<%= TelerikUninstallOptionClientID %>"] = option; upgradeWizard.showInstallationTab(); upgradeWizard.upgrade(); } diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs index 8f1dbb13d6b..5b0227c8cc0 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs @@ -341,6 +341,7 @@ private static SecurityTabResult GetTelerikNotInstalledResult() CanProceed = true, View = RenderControls( CreateTelerikAntiForgeryTokenField(), + CreateHiddenField(TelerikUninstallOptionClientID, OptionNo), CreateHeading("TelerikNotInstalledHeading"), CreateParagraph("TelerikNotInstalledInfo")), }; @@ -377,6 +378,7 @@ private static SecurityTabResult GetTelerikInstalledAndUsedResult( CanProceed = true, View = RenderControls( CreateTelerikAntiForgeryTokenField(), + CreateHiddenField(TelerikUninstallOptionClientID, OptionNo), CreateTelerikInstalledHeader(version), CreateParagraph($"TelerikInstalledAndUsed{damPresentOrRemoved}Info"), CreateTable(assemblies, maxRows: 3, maxColumns: 4), @@ -384,14 +386,8 @@ private static SecurityTabResult GetTelerikInstalledAndUsedResult( }; } - private static Control CreateTelerikAntiForgeryTokenField() - { - return new HiddenField - { - ID = TelerikAntiForgeryTokenClientID, - Value = CreateTelerikAntiForgeryToken(), - }; - } + private static Control CreateTelerikAntiForgeryTokenField() => + CreateHiddenField(TelerikAntiForgeryTokenClientID, CreateTelerikAntiForgeryToken()); private static Control CreateTelerikInstalledHeader(string version) { @@ -442,6 +438,15 @@ private static Control CreateLabel(string tag, string localizationKey) return control; } + private static Control CreateHiddenField(string id, string value) + { + return new HiddenField + { + ID = id, + Value = value, + }; + } + private static Table CreateTable(IEnumerable items, int maxRows, int maxColumns) { var capacity = maxRows * maxColumns; From a09dfdd0311e578cd49f580324eeeee5fe6cc945 Mon Sep 17 00:00:00 2001 From: armaganpekatik Date: Fri, 24 Jun 2022 07:15:22 +0000 Subject: [PATCH 35/37] text fix and rebuild for artefacts --- .../Modules/TelerikRemoval/App_LocalResources/View.ascx.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx index 8e751694e48..374818898d3 100644 --- a/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx +++ b/DNN Platform/Modules/TelerikRemoval/App_LocalResources/View.ascx.resx @@ -190,7 +190,7 @@ Update provider for '{0}' in DataType list - Web.config: remove Telerik from {0} + Web.config: Remove Telerik from {0} Clean up dependency records for package '{0}' From d092faddad66f8bdd09e59e7d14082e33f057ed5 Mon Sep 17 00:00:00 2001 From: Armagan Pekatik <42939859+armaganpekatik@users.noreply.github.com> Date: Thu, 7 Jul 2022 09:37:32 +0300 Subject: [PATCH 36/37] Update DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn Co-authored-by: Brian Dukes --- DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn index 6a0d04436fd..f60b15460a1 100644 --- a/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn +++ b/DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn @@ -66,7 +66,7 @@ UpgradeModule Dnn.Modules.TelerikRemoval.UpgradeController, Dnn.Modules.TelerikRemoval - upgrade + install From a74bb1b2e5faeaca2ca073b0e9840333a317c068 Mon Sep 17 00:00:00 2001 From: Armagan Pekatik <42939859+armaganpekatik@users.noreply.github.com> Date: Thu, 7 Jul 2022 09:37:39 +0300 Subject: [PATCH 37/37] Update DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider Co-authored-by: Brian Dukes --- .../SqlDataProvider/09.11.00.SqlDataProvider | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider b/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider index 5f66855923a..6082400c277 100644 --- a/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider +++ b/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.11.00.SqlDataProvider @@ -51,17 +51,6 @@ BEGIN END GO -/* Install the Telerik Removal extension */ -/************************************************************/ - -IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}Packages] WHERE [Name] = 'TelerikRemoval') - INSERT INTO {databaseOwner}[{objectQualifier}Packages] ( - [PortalID], [Name], [FriendlyName], [PackageType], [Version], [CreatedByUserID], [CreatedOnDate] - ) - VALUES ( - NULL, 'TelerikRemoval', 'Telerik Removal', 'Module', '9.11.0', -1, GETDATE() - ) -GO /************************************************************/

UninstallReportStepColumnUninstallReportResultColumnUninstallReportNotesColumn + UninstallReportStepColumn + UninstallReportResultColumn + UninstallReportNotesColumn