Forum


HomeHomePremiumPremiumDevelopmentDevelopmentDetermining modules in a DNN 8 database.Determining modules in a DNN 8 database.
Previous
 
Next
New Post
8/25/2017 3:18 AM
 

Hi Aderson,

I'm trying to determine all the modules for a given portal in a DNN 8 database.
I'm using 'public ArrayList GetModules(int portalID);' and then filtering the results to find the modules I want.

But querying the database directly, I was surprised to find that some records in the modules table have a null PortalID.

Obviously, I can't find modules with a null portal ID with a non-nullable integer using the above method. I am concerned that these records have had their Portal ID set to zero for some reason and they will be ignored by my app when they shouldn't be.

So I'm wondering how or why some module records, 21 in this case, could have their portal ID value set to null in the first place?

 

Hope this all makes sense, please let me know otherwise.

Best Regards,

Steve

 
New Post
8/25/2017 4:02 AM
 

CORRECTION: I'm sorry I meant to say the records have been set to NULL not zero in the above sentence which should read as follows:
I am concerned that these records have had their Portal ID set to NULL for some reason and they will be ignored by my app when they shouldn't be.

 
New Post
8/25/2017 11:40 AM
 

Hi Steve,

I'm not sure I can answer that question, but I will for sure at least speculate.

But before that, when you say "...querying the database directly..." which table(s) did you query? Please post your query.

Cheers,

Aderson

 
New Post
8/25/2017 12:12 PM
 

Hi Aderson,

Thank you for your reply.

Yes good point, that would be the 'Modules' table, my query is below. I suppose I should try using it on some other DNN databases and see if they all have records with a null PortalID. 
I tried clearing out the deleted modules, so it's not that, in any case the IsDeleted field is set to 0, which I can only assume mean their not.
I can't find the modules that appear in the results on the site though. That could be because I've just missed them, but I did have a pretty thorough check.

If I take the moduleid one of the modules in the results from the Modules query below and use it in a where clause in the TabModules table (407 in this case) I found the tabid for that module. I then used the tabid from the the tabs table (71 in my case as shown below.) That shows a tab record where the IsDeleted field is set to 1. I can also see the tab name, which I couldn't find in my menu or in the page management system. So I think the records are perhaps left there from a failed delete or something, but it's just a guess.

I emptied the recycle bin by the way.

There's no tool around to clean up the database I suppose? Otherwise, I think they can be ignored.

Best Regards,

Steve


/*********************
Modules table query
**********************/


SELECT TOP 1000 [ModuleID]
      ,[ModuleDefID]
      ,[AllTabs]
      ,[IsDeleted]
      ,[InheritViewPermissions]
      ,[StartDate]
      ,[EndDate]
      ,[PortalID]
      ,[CreatedByUserID]
      ,[CreatedOnDate]
      ,[LastModifiedByUserID]
      ,[LastModifiedOnDate]
      ,[LastContentModifiedOnDate]
      ,[ContentItemID]
      ,[IsShareable]
      ,[IsShareableViewOnly]
  FROM [dnn8].[dbo].[Modules]
  where portalid is null


/*********************
TabModules table query
**********************/
SELECT TOP 1000 [TabModuleID]
      ,[TabID]
      ,[ModuleID]
      ,[PaneName]
      ,[ModuleOrder]
      ,[CacheTime]
      ,[Alignment]
      ,[Color]
      ,[Border]
      ,[IconFile]
      ,[Visibility]
      ,[ContainerSrc]
      ,[DisplayTitle]
      ,[DisplayPrint]
      ,[DisplaySyndicate]
      ,[IsWebSlice]
      ,[WebSliceTitle]
      ,[WebSliceExpiryDate]
      ,[WebSliceTTL]
      ,[CreatedByUserID]
      ,[CreatedOnDate]
      ,[LastModifiedByUserID]
      ,[LastModifiedOnDate]
      ,[IsDeleted]
      ,[CacheMethod]
      ,[ModuleTitle]
      ,[Header]
      ,[Footer]
      ,[CultureCode]
      ,[UniqueId]
      ,[VersionGuid]
      ,[DefaultLanguageGuid]
      ,[LocalizedVersionGuid]
  FROM [dnn8].[dbo].[TabModules]
  where moduleid = 407

/***************************
Tabs table query
*************************/

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [TabID]
      ,[TabOrder]
      ,[PortalID]
      ,[TabName]
      ,[IsVisible]
      ,[ParentId]
      ,[IconFile]
      ,[DisableLink]
      ,[Title]
      ,[Description]
      ,[KeyWords]
      ,[IsDeleted]
      ,[Url]
      ,[SkinSrc]
      ,[ContainerSrc]
      ,[StartDate]
      ,[EndDate]
      ,[RefreshInterval]
      ,[PageHeadText]
      ,[IsSecure]
      ,[PermanentRedirect]
      ,[SiteMapPriority]
      ,[CreatedByUserID]
      ,[CreatedOnDate]
      ,[LastModifiedByUserID]
      ,[LastModifiedOnDate]
      ,[IconFileLarge]
      ,[CultureCode]
      ,[ContentItemID]
      ,[UniqueId]
      ,[VersionGuid]
      ,[DefaultLanguageGuid]
      ,[LocalizedVersionGuid]
      ,[Level]
      ,[TabPath]
      ,[HasBeenPublished]
      ,[IsSystem]
  FROM [dnn8].[dbo].[Tabs]
  where tabid = 71

 
New Post
8/25/2017 1:21 PM
 

The reason I really don't know but to get the modules used on a portal I would go via the "Tabs" first:

Tabs.PortalId = 0

Then join with "TabModules"

TabModules.TabId = Tabs.TabId

Then join with "Modules"

TabModules.ModuleId = Modules.ModuleId

I think that would get what you want.

Cheers,

Aderson

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentDetermining modules in a DNN 8 database.Determining modules in a DNN 8 database.



Try FREE
30 days money back guaranteed