Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from Kentico repo #2

Merged
merged 34 commits into from
May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d698163
implement ClickJacking Protection Module - This module checks to see …
Oct 1, 2016
396cefc
Implement ClickJacking protection module - This module checks to see if
Oct 1, 2016
15d6405
merge due to clickjacking module implementation
Oct 1, 2016
e946833
add ClickJackingModule.cs file to project, fetching CMSXFrameOptionsE…
Oct 6, 2016
027a956
Merge branch 'master' into master
pijemcolu Oct 13, 2016
0f68571
Merge pull request #1 from Kentico/master
Enngage Nov 9, 2016
6ba4854
Fixes Workflow Consistency module in K9 when page is using page type …
Enngage Nov 9, 2016
075ff52
Merge pull request #127 from Enngage/master
ChristopherJennings Nov 10, 2016
7f26eda
Update README.md
petrsvihlik Dec 8, 2016
158f8dd
Bugfixes for Form Attachments and Media Library Consistency Check mod…
ChristopherBass Dec 9, 2016
460f055
Merge branch 'master' into master
ChristopherJennings Dec 9, 2016
37dca92
Fix config key name; adds better null check
ChristopherJennings Dec 9, 2016
07c925f
Merge branch 'pijemcolu-master'
ChristopherJennings Dec 9, 2016
ba62cf5
Fixes #9. Added debug check module. This module checks the web.config…
harpesichord Oct 3, 2016
f5ca718
Implemented feedback from PR comments
ChristopherJennings Dec 9, 2016
fac9141
Merge branch 'harpesichord-master'
ChristopherJennings Dec 9, 2016
42de050
Add unused templates and page types modules (#132)
ChristopherJennings Dec 12, 2016
7899c93
Expand supported versions for unused templates module (#133)
ChristopherJennings Dec 15, 2016
11911f6
Security settings web config (#134)
ChristopherJennings Dec 15, 2016
437b6a2
Add note about check for SA in connection string
ChristopherJennings Dec 15, 2016
da2e441
Page template names (#135)
ChristopherJennings Dec 15, 2016
4621207
Resolves issue 131 (#136)
ChristopherJennings Dec 15, 2016
384ea0b
Resolves #103, #116 - Big Tables by Size (MB)
ChristopherJennings Dec 15, 2016
f79408b
Fixes main issue of passing list of things to SQL IN
ChristopherJennings Dec 19, 2016
978d387
Remove extra SQL that was separated to another script
ChristopherJennings Dec 21, 2016
c709c4d
Overhaul transformation analyzer to return more data
ChristopherJennings Dec 21, 2016
ffea1d9
Further clean up report generation
ChristopherJennings Dec 21, 2016
890bc0c
Merge pull request #138 from ChristopherJennings/fix-126-transformati…
ChristopherJennings Jan 5, 2017
4f7c3eb
Add initial code for task processing issues module.
ChristopherJennings Jan 12, 2017
87f281f
Remove untested versions
ChristopherJennings Jan 12, 2017
8eb2a1f
Merge pull request #139 from ChristopherJennings/feature-task-process…
ChristopherJennings Jan 12, 2017
a5d93ce
Resolves #123 - Update modules that can support V10
ileshmistry Jan 19, 2017
82bdcce
Enables all setup modules except license
ChristopherJennings Jan 19, 2017
618656b
Fixes #7 "Check for disabled web parts" (#146)
CasperRademaker Feb 1, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions KInspector.Modules/Kentico.KInspector.Modules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@
<Compile Include="Modules\Content\NumberOfAliasesModule.cs" />
<Compile Include="Modules\Content\RobotsTxtModule.cs" />
<Compile Include="Modules\Content\PageTypeAssignedToSiteModule.cs" />
<Compile Include="Modules\Content\UnusedPageTypesModule.cs" />
<Compile Include="Modules\Content\UnusedTemplatesModule.cs" />
<Compile Include="Modules\Content\WebPartsInTransformationsModule.cs" />
<Compile Include="Modules\Content\WorkflowConsistencyModule.cs" />
<Compile Include="Modules\General\TaskProcessingIssuesModule.cs" />
<Compile Include="Modules\General\DebugCheckModule.cs" />
<Compile Include="Modules\EventLog\EventLogErrorsModule.cs" />
<Compile Include="Modules\Content\DuplicatePageAliasesModule.cs" />
<Compile Include="Modules\EventLog\EventLogSizeModule.cs" />
Expand All @@ -139,6 +143,8 @@
<Compile Include="Modules\OnlineMarketing\OMInactiveContactsDeletion.cs" />
<Compile Include="Modules\OnlineMarketing\OMNewslettersWithoutQueue.cs" />
<Compile Include="Modules\OnlineMarketing\OMTablesSize.cs" />
<Compile Include="Modules\General\DisabledWebPartAnalyzer.cs" />
<Compile Include="Modules\Security\ClickJackingModule.cs" />
<Compile Include="Modules\Security\DataStructures\VulnerabilityAnalysisResults.cs" />
<Compile Include="Modules\Security\FloodProtectionModule.cs" />
<Compile Include="Modules\Security\PasswordPolicyModule.cs" />
Expand Down Expand Up @@ -202,6 +208,12 @@
<Content Include="ProbeData\CMSPages\KInspectorProbe.aspx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\DisabledWebPartAnalyzerModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\DebugCheckModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\FloodProtectionModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand All @@ -211,9 +223,30 @@
<Content Include="Scripts\PageTypeFieldsDataTypeMismatchModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\Setup\GlobalAdminSetupModule-V10.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\Setup\GlobalAdminSetupModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TaskProcessingIssueModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TransformationAnalyzerModule-GetDataWhereIn-KI_ClassNames.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TransformationAnalyzerModule-Initialize-KI_ClassNames.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TransformationAnalyzerModule-Initialize-KI_TransformationList.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\UnusedPageTypesModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\UnusedTemplatesModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\WebPartColumnsModule9.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -244,7 +277,7 @@
<Content Include="Scripts\PasswordPolicy.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TransformationAnalyzerModule-TransformationCodes.sql">
<Content Include="Scripts\TransformationAnalyzerModule-GetDataWhereIn-KI_TransformationList.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\TransformationAnalyzerModule-PageTemplateWebParts.sql">
Expand Down Expand Up @@ -348,7 +381,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\DocumentsConsistencyIssuesModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\UsersWithEmptyPasswordsModule.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public ModuleMetadata GetModuleMetadata()
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Comment =
@"Displays report of all attachments ordered by their size.
Expand Down
21 changes: 13 additions & 8 deletions KInspector.Modules/Modules/Content/DBFileConsistencyModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public ModuleMetadata GetModuleMetadata()
{
Name = "Form Attachments and Media Library Consistency Check",
SupportedVersions = new[] {
new Version("6.0"),
new Version("7.0"),
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
Expand Down Expand Up @@ -368,14 +366,21 @@ public static FileInfo[] GetFiles(string baseUri, bool recursive, IInstanceInfo
throw new ArgumentNullException($"baseUri value is null");
}

if(baseUri.StartsWith("~/"))
try
{
if(baseUri.StartsWith("~/"))
{
var absPath = Combine(info.Directory.FullName, baseUri.Substring(2));
return Directory.Exists(absPath) ? new DirectoryInfo(absPath).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) : new FileInfo[] { };
}
else
return Directory.Exists(baseUri) ? new DirectoryInfo(baseUri).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) : new FileInfo[] { };
}
catch(Exception ex)
{
var absPath = Combine(info.Directory.FullName, baseUri.Substring(2));
return new DirectoryInfo(absPath).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
throw ex;
}
else
return new DirectoryInfo(baseUri).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
}
}

/// <summary>
/// Combines a base url with a list of folders afterwards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public ModuleMetadata GetModuleMetadata()
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Comment = @"Checks that the CMS_DocumentAlias table does not contain any duplicates.",
Category = "Content"
Expand Down
4 changes: 3 additions & 1 deletion KInspector.Modules/Modules/Content/NumberOfAliasesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public ModuleMetadata GetModuleMetadata()
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0") },
new Version("9.0"),
new Version("10.0")
},
Comment = @"Returns number of aliases per node + total count of aliases and documents for direct comparison.

Having too many aliases per node may suggest problem with wrong API usage, decreased performance and SEO problems.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public ModuleMetadata GetModuleMetadata()
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Comment = @"Displays page types used by a certain site without being assigned to this site.

Expand Down
30 changes: 22 additions & 8 deletions KInspector.Modules/Modules/Content/SiteTemplatesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@ public ModuleMetadata GetModuleMetadata()
{
return new ModuleMetadata
{
Name = "Site templates",
Name = "Page template overview",
SupportedVersions = new[] {
new Version("7.0"),
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Comment = @"Analyzes all templates used on sites.",
Comment = @"Shows the basic web part configuration for all page templates and lists all the documents that use that template.",
};
}

Expand All @@ -89,17 +90,24 @@ public ModuleResults GetResults(IInstanceInfo instanceInfo)
if (results.Tables.Contains(templateName))
{
// Page template code names should be unique
templateName += " - DUPLICATE CODENAME (ID: " + template["PageTemplateID"] + ")";
templateName += $" - DUPLICATE CODENAME, ID: {template["PageTemplateID"]}";
duplicateTemplateCodeName = true;
}
DataTable result = GetTableForTemplateResult(templateName);

var tableHeader = $"{template["PageTemplateDisplayName"]} [{templateName}]";

DataTable result = GetTableForTemplateResult(tableHeader);

if (templateWP.WebPartZones != null)
{
foreach (var zone in templateWP.WebPartZones)
{
if (zone.WebParts == null || zone.WebParts.Length == 0)
{
var row = result.NewRow();
row["WebPartTitle"] = "No web parts";
row["Zone"] = zone.ID;
result.Rows.Add(row);
continue;
}
foreach (var wp in zone.WebParts)
Expand Down Expand Up @@ -138,12 +146,18 @@ public ModuleResults GetResults(IInstanceInfo instanceInfo)
}
}
}
else
{
var row = result.NewRow();
row["WebPartTitle"] = "No web part zones";
result.Rows.Add(row);
}

results.Tables.Add(result);

var documents = dbService.ExecuteAndGetTableFromFile("SiteTemplatesModule-Documents.sql",
new SqlParameter("PageTemplateID", template["PageTemplateID"]));
documents.TableName = $"{templateName} - Documents";
documents.TableName = $"{tableHeader} - Documents";
results.Tables.Add(documents.Copy());
}

Expand Down Expand Up @@ -171,9 +185,9 @@ protected TemplateWebParts GetTemplateWebPartsFromXML(string xml)
}
}

protected DataTable GetTableForTemplateResult(string templateName)
protected DataTable GetTableForTemplateResult(string tableName)
{
DataTable result = new DataTable(templateName);
DataTable result = new DataTable(tableName);
result.Columns.Add("WebPartTitle");
result.Columns.Add("WebPartType");
result.Columns.Add("ID");
Expand Down
3 changes: 2 additions & 1 deletion KInspector.Modules/Modules/Content/TreeNodeChildrenModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public ModuleMetadata GetModuleMetadata()
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Comment = @"Displays TreeNodes having more than 1000 children.

Expand Down
41 changes: 41 additions & 0 deletions KInspector.Modules/Modules/Content/UnusedPageTypesModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using Kentico.KInspector.Core;

namespace Kentico.KInspector.Modules
{
public class UnusedPageTypesModule : IModule
{
public ModuleMetadata GetModuleMetadata()
{
return new ModuleMetadata
{
Name = "Unused page types",
SupportedVersions = new[] {
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0"),
new Version("10.0")
},
Comment = @"Looks for unused page types.",
};
}


public ModuleResults GetResults(IInstanceInfo instanceInfo)
{
var dbService = instanceInfo.DBService;
var unusedTemplates = dbService.ExecuteAndGetTableFromFile("UnusedPageTypesModule.sql");

return new ModuleResults
{
Result = unusedTemplates
};
}
}
}
41 changes: 41 additions & 0 deletions KInspector.Modules/Modules/Content/UnusedTemplatesModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using Kentico.KInspector.Core;

namespace Kentico.KInspector.Modules
{
public class UnusedTemplatesModule : IModule
{
public ModuleMetadata GetModuleMetadata()
{
return new ModuleMetadata
{
Name = "Unused templates",
SupportedVersions = new[] {
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0"),
new Version("10.0")
},
Comment = @"Looks for unused templates.",
};
}


public ModuleResults GetResults(IInstanceInfo instanceInfo)
{
var dbService = instanceInfo.DBService;
var unusedTemplates = dbService.ExecuteAndGetTableFromFile("UnusedTemplatesModule.sql");

return new ModuleResults
{
Result = unusedTemplates
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ You should use hierarchical transformation instead (see https://docs.kentico.com
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
new Version("9.0"),
new Version("10.0")
},
Category = "Content",
};
Expand Down
Loading