Ismet Dumlupinar wrote
I have tons of modules installed at mywebsite. Now i want to clear up unused modules.
Do you have any code that helps me findout unused modules?
This is from a previous thread along the same subject: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/118/threadid/190029/scope/posts/threadpage/2/Default.aspx
ROBAX wrote
There are ways using sql to show which modules are being used where...
Here is the SQL SELECT statements we use to report portal module use and non-use. I hope this helps.
This SQL statement returns the pages in all portals which my installed modules are being used on:
SELECT TOP 100 PERCENT dbo.DesktopModules.DesktopModuleID, dbo.DesktopModules.FriendlyName, dbo.ModuleDefinitions.ModuleDefID,
dbo.Modules.ModuleID, dbo.Modules.ModuleTitle, dbo.Modules.AllTabs, dbo.Modules.PortalID, dbo.Tabs.ParentId, dbo.Tabs.TabID,
dbo.Tabs.TabName, dbo.Tabs.Title
FROM dbo.TabModules INNER JOIN
dbo.Modules ON dbo.TabModules.ModuleID = dbo.Modules.ModuleID INNER JOIN
dbo.Tabs ON dbo.TabModules.TabID = dbo.Tabs.TabID INNER JOIN
dbo.ModuleDefinitions ON dbo.Modules.ModuleDefID = dbo.ModuleDefinitions.ModuleDefID INNER JOIN
dbo.DesktopModules ON dbo.ModuleDefinitions.DesktopModuleID = dbo.DesktopModules.DesktopModuleID
WHERE (dbo.DesktopModules.FriendlyName = 'Reports')
ORDER BY dbo.DesktopModules.DesktopModuleID, dbo.Tabs.TabName
Results (you can omit the WHERE clause)
This SQL statement returns which installed modules are NOT being used:
SELECT TOP 100 PERCENT dbo.DesktopModules.DesktopModuleID, dbo.DesktopModules.FriendlyName, dbo.DesktopModules.Version,
dbo.DesktopModules.IsPremium
FROM dbo.Modules INNER JOIN
dbo.TabModules ON dbo.Modules.ModuleID = dbo.TabModules.ModuleID INNER JOIN
dbo.ModuleDefinitions ON dbo.Modules.ModuleDefID = dbo.ModuleDefinitions.ModuleDefID RIGHT OUTER JOIN
dbo.DesktopModules ON dbo.ModuleDefinitions.DesktopModuleID = dbo.DesktopModules.DesktopModuleID
WHERE (dbo.DesktopModules.IsAdmin = 0)
GROUP BY dbo.DesktopModules.DesktopModuleID, dbo.DesktopModules.FriendlyName, dbo.DesktopModules.Version, dbo.DesktopModules.IsPremium
HAVING (COUNT(dbo.TabModules.TabID) = 0)
ORDER BY dbo.DesktopModules.FriendlyName
Results