DNNCommunity / DNN.SiteLog

A sitelog module which replaces the feature from DNN Platform which was removed as part of DNN 8.
MIT License
9 stars 9 forks source link

SiteLog 8.0.1 not working with DNN 9.1.0 #20

Open digitalsigi opened 5 years ago

digitalsigi commented 5 years ago

Describe the bug

I'm running DNN 9.1.0 and installed SiteLog. I didn't even show up in any menu. Astonishing after logout/login SiteLog Entry found in Admin Menu. Clicked on it, was kicked out, had to login again, menu entry was no longer there. Even more SiteLog entry was not found in list of Extensions.

There are no entries in the Logs.

Software Versions

To Reproduce

Steps to reproduce the behavior:

  1. Install DNN 9.1.0
  2. Install SiteLog 8.0.1
  3. Look through menus
  4. See error -> no SiteLog

Expected behavior

OK, SiteLog should work.

WillStrohl commented 5 years ago

The module not appearing right away is expected because the persona bar doesn't know to reload the menu options. All that should be required for anything added into the persona bar after installation is to refresh the page.

It won't work by default on a clean instance of 8.xx and newer because the settings aren't in place to enable it and they won't be there until you add them. There also isn't a UI to add them any longer. You'll have to add them manually using a query like the example below.

In short, the current iteration of this module simply was migrated from a previous version of DNN, and it assumes that you already had the necessary settings in place.

If running in SSMS:

IF NOT EXISTS (SELECT 1 FROM [dbo].[HostSettings] WHERE [SettingName] = N'SiteLogBuffer')
BEGIN
    INSERT INTO [dbo].[HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogBuffer', N'1', 0, -1, GETDATE(), -1, GETDATE());
END

IF NOT EXISTS (SELECT 1 FROM [dbo].[HostSettings] WHERE [SettingName] = N'SiteLogHistory')
BEGIN
    -- update the number of days to be any number you desire
    INSERT INTO [dbo].[HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogHistory', N'60', 0, -1, GETDATE(), -1, GETDATE());
END

-- run this query for each portal in your installation you wish to support, changing the PortalID to match, as required
IF NOT EXISTS (SELECT 1 FROM [dbo].[PortalSettings] WHERE [SettingName] = N'SiteLogHistory')
BEGIN
    -- update the number of days to be any number you desire
    INSERT INSERT INTO [dbo].[PortalSettings] ([PortalId], [SettingName], [SettingValue], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (0, N'SiteLogHistory', N'60', -1, GETDATE(), -1, GETDATE());
END

IF NOT EXISTS (SELECT 1 FROM [dbo].[HostSettings] WHERE [SettingName] = N'SiteLogStorage')
BEGIN
    INSERT INTO [dbo].[HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogStorage', N'D', 0, -1, GETDATE(), -1, GETDATE());
END

If running in DNN's SQL console:

IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}HostSettings] WHERE [SettingName] = N'SiteLogBuffer')
BEGIN
    INSERT INTO {databaseOwner}[{objectQualifier}HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogBuffer', N'1', 0, -1, GETDATE(), -1, GETDATE());
END

IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}HostSettings] WHERE [SettingName] = N'SiteLogHistory')
BEGIN
    -- update the number of days to be any number you desire
    INSERT INTO {databaseOwner}[{objectQualifier}HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogHistory', N'60', 0, -1, GETDATE(), -1, GETDATE());
END

-- run this query for each portal in your installation you wish to support, changing the PortalID to match, as required
IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}PortalSettings] WHERE [SettingName] = N'SiteLogHistory')
BEGIN
    -- update the number of days to be any number you desire
    INSERT INSERT INTO {databaseOwner}[{objectQualifier}PortalSettings] ([PortalId], [SettingName], [SettingValue], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (0, N'SiteLogHistory', N'60', -1, GETDATE(), -1, GETDATE());
END

IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[{objectQualifier}HostSettings] WHERE [SettingName] = N'SiteLogStorage')
BEGIN
    INSERT INTO {databaseOwner}[{objectQualifier}HostSettings] ([SettingName], [SettingValue], [SettingIsSecure], [CreatedByUserID], [CreatedOnDate], [LastModifiedByUserID], [LastModifiedOnDate]) 
    VALUES (N'SiteLogStorage', N'D', 0, -1, GETDATE(), -1, GETDATE());
END
WillStrohl commented 5 years ago

Oh, and a point of clarification on the previous comment...

SiteLogHistory in the HostSettings table is simply used by some internal DNN logic when creating a new website (portal) as a default value.

Once the PortalSettings table has any value above 0 for the SiteLogHistory setting, then SiteLog is enabled for that website and that website only (if there is more than one website in that instance of DNN).

I just tested all of this in DNN Platform 09.03.02.