From ef3f166940c7216418d4064fa5016b45c2ccd430 Mon Sep 17 00:00:00 2001 From: donker Date: Tue, 24 Sep 2019 22:24:47 +0200 Subject: [PATCH 1/2] Fix issues with upgrade of personabar to version 9.4.0 where old controllers were still in the DB and old packages were still registered --- .../SqlDataProvider/09.04.01.SqlDataProvider | 24 ++++ .../SqlDataProvider/09.04.01.SqlDataprovider | 103 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 Extensions/Content/Dnn.PersonaBar.Extensions/SqlDataProvider/09.04.01.SqlDataProvider create mode 100644 Library/Dnn.PersonaBar.UI/SqlDataProvider/09.04.01.SqlDataprovider diff --git a/Extensions/Content/Dnn.PersonaBar.Extensions/SqlDataProvider/09.04.01.SqlDataProvider b/Extensions/Content/Dnn.PersonaBar.Extensions/SqlDataProvider/09.04.01.SqlDataProvider new file mode 100644 index 000000000..b038c5375 --- /dev/null +++ b/Extensions/Content/Dnn.PersonaBar.Extensions/SqlDataProvider/09.04.01.SqlDataProvider @@ -0,0 +1,24 @@ +/************************************************************/ +/***** SqlDataProvider *****/ +/***** *****/ +/***** *****/ +/***** Note: To manually execute this script you must *****/ +/***** perform a search and replace operation *****/ +/***** for {databaseOwner} and {objectQualifier} *****/ +/***** *****/ +/************************************************************/ + +/* Fix faulty 9.4.0 upgrades of the PersonaBar */ + +DELETE +FROM {databaseOwner}{objectQualifier}Packages +WHERE PackageType='PersonaBar' +AND [Name] <> 'Dnn.PersonaBar.Extensions' +AND Organization='DNN Corp.' +GO + +UPDATE {databaseOwner}{objectQualifier}PersonaBarMenu +SET Controller = LEFT(Controller, CHARINDEX(',',Controller)-1) + ', Dnn.PersonaBar.Extensions' +WHERE Identifier IN ('Dnn.AdminLogs','Dnn.ConfigConsole','Dnn.CssEditor','Dnn.Extensions','Dnn.Licensing','Dnn.Security','Dnn.Seo','Dnn.Servers','Dnn.Sites','Dnn.SiteSettings','Dnn.SqlConsole','Dnn.TaskScheduler','Dnn.Themes','Dnn.Users','Dnn.Pages','Dnn.SiteImportExport') +GO + diff --git a/Library/Dnn.PersonaBar.UI/SqlDataProvider/09.04.01.SqlDataprovider b/Library/Dnn.PersonaBar.UI/SqlDataProvider/09.04.01.SqlDataprovider new file mode 100644 index 000000000..b2ad3f5de --- /dev/null +++ b/Library/Dnn.PersonaBar.UI/SqlDataProvider/09.04.01.SqlDataprovider @@ -0,0 +1,103 @@ +/************************************************************/ +/***** SqlDataProvider *****/ +/***** *****/ +/***** *****/ +/***** Note: To manually execute this script you must *****/ +/***** perform a search and replace operation *****/ +/***** for {databaseOwner} and {objectQualifier} *****/ +/***** *****/ +/************************************************************/ + +/* Issue 1163: Fix update of Personabar where controller wasn't updated */ + +IF EXISTS (SELECT * FROM dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}PersonaBar_SavePersonaBarMenu') and OBJECTPROPERTY(id, N'IsProcedure') = 1) + DROP PROCEDURE {databaseOwner}{objectQualifier}PersonaBar_SavePersonaBarMenu +GO + +CREATE PROCEDURE {databaseOwner}[{objectQualifier}PersonaBar_SavePersonaBarMenu] + @Identifier NVARCHAR(50), + @ModuleName NVARCHAR(50), + @FolderName NVARCHAR(50), + @Controller NVARCHAR(260), + @ResourceKey NVARCHAR(50), + @Path NVARCHAR(260), + @Link NVARCHAR(260), + @CssClass NVARCHAR(50), + @ParentId INT, + @Order INT, + @AllowHost BIT, + @Enabled BIT, + @CurrentUserId INT, + @IconFile NVARCHAR(260) = '' +AS +BEGIN + IF EXISTS(SELECT Identifier FROM {databaseOwner}[{objectQualifier}PersonaBarMenu] WHERE Identifier = @Identifier) + BEGIN + UPDATE {databaseOwner}[{objectQualifier}PersonaBarMenu] + SET + ModuleName = @ModuleName, + FolderName = @FolderName, + Controller = @Controller, + ResourceKey = @ResourceKey, + Path = @Path, + Link = @Link, + CssClass = @CssClass, + IconFile = @IconFile, + ParentId = @ParentId, + [Order] = @Order, + AllowHost = @AllowHost, + Enabled = @Enabled, + LastModifiedByUserId = CASE WHEN @CurrentUserId = -1 THEN NULL ELSE @CurrentUserId END, + LastModifiedOnDate = GETDATE() + WHERE Identifier = @Identifier + + SELECT MenuId FROM {databaseOwner}[{objectQualifier}PersonaBarMenu] WHERE Identifier = @Identifier + END + ELSE + BEGIN + INSERT INTO {databaseOwner}[{objectQualifier}PersonaBarMenu] ( + [Identifier], + [ModuleName], + [FolderName], + [Controller], + [ResourceKey], + [Path], + [Link], + [CssClass], + [IconFile], + [ParentId], + [Order], + [AllowHost], + [Enabled], + [CreatedByUserId], + [CreatedOnDate], + [LastModifiedByUserId], + [LastModifiedOnDate] + ) VALUES ( + @Identifier, + @ModuleName, + @FolderName, + @Controller, + @ResourceKey, + @Path, + @Link, + @CssClass, + @IconFile, + @ParentId, + @Order, + @AllowHost, + @Enabled, + CASE WHEN @CurrentUserId = -1 THEN NULL ELSE @CurrentUserId END, + GETDATE(), + CASE WHEN @CurrentUserId = -1 THEN NULL ELSE @CurrentUserId END, + GETDATE() + ) + + SELECT SCOPE_IDENTITY() + END +END +GO + +/************************************************************/ +/***** SqlDataProvider *****/ +/************************************************************/ \ No newline at end of file From e432223d1dbda879ca129ea192cce58662087946 Mon Sep 17 00:00:00 2001 From: donker Date: Tue, 24 Sep 2019 22:25:28 +0200 Subject: [PATCH 2/2] Update projects --- .../Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj | 3 +++ Library/Dnn.PersonaBar.UI/Dnn.PersonaBar.UI.csproj | 1 + 2 files changed, 4 insertions(+) diff --git a/Extensions/Content/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj b/Extensions/Content/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj index ed872f785..1882749b6 100644 --- a/Extensions/Content/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj +++ b/Extensions/Content/Dnn.PersonaBar.Extensions/Dnn.PersonaBar.Extensions.csproj @@ -714,6 +714,9 @@ + + + diff --git a/Library/Dnn.PersonaBar.UI/Dnn.PersonaBar.UI.csproj b/Library/Dnn.PersonaBar.UI/Dnn.PersonaBar.UI.csproj index 7b5c11d09..860813027 100644 --- a/Library/Dnn.PersonaBar.UI/Dnn.PersonaBar.UI.csproj +++ b/Library/Dnn.PersonaBar.UI/Dnn.PersonaBar.UI.csproj @@ -209,6 +209,7 @@ +