Skip to content

Commit b7a3acb

Browse files
authored
Merge pull request #3 from solutionexchange/DOTNET-408
Add support for sending maintenance report
2 parents 1173073 + a49be37 commit b7a3acb

22 files changed

Lines changed: 769 additions & 4 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
Private/Store/configuration.xml
2-
*.pwd
2+
*.pwd
3+
.idea/
4+
mail.config.json

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,41 @@
22

33
about **SmartConsole for Web Site Management** (Release 16.0 and also 11.2).
44

5+
## v0.3.0 - 2020-02-19
56

7+
### New Features
8+
9+
- Added `Measure-PagePreviewPerformance.ps1` and respective report to get a list of pages in a project
10+
and how they perform with and without cache (Be careful when using, since they
11+
delete the cache on the management server you configured)
12+
- Added `Get-AllContentClassesInEditing.ps1` and respective report to get a list of content classes
13+
which templates are being edited right now based on variant, time locked and locked by
14+
- Added `Get-AllContentClassesWithNElements.ps1` and respective report to
15+
get all content classes which surpass a given element count threshold
16+
- Added `Find-MSPages.ps1` to search for pages. Currently only supports Keywords
17+
- Added `Send-MaintenanceReport` which accepts a `ReportData` parameter to
18+
convert data to HTML and sent it to the recipients passed as argument. You can add
19+
custom templates to `Reports/Templates/$ReportName` folder which get merged with the
20+
base template. Check `mail.config.json.sample` for mail settings
21+
- Changed versioning to semantic versioning
22+
23+
### Overview
24+
25+
- Read the [OVERVIEW.md](Wiki/OVERVIEW.md) document for more information.
26+
27+
### FAQ
28+
29+
- Read the [FAQ.md](Wiki/FAQ.md) document for more information.
30+
31+
### Known Issues
32+
33+
- Read the [KNOWNISSUES.md](Wiki/KNOWNISSUES.md) document for more information.
34+
35+
------
36+
37+
### Breaking changes
38+
39+
- No breaking changes have been introduced
640

741
## v0.2.7 - 2018-05-22
842

@@ -679,4 +713,4 @@ about **SmartConsole for Web Site Management** (Release 16.0 and also 11.2).
679713

680714
### Known Issues
681715

682-
- Read the [KNOWNISSUES.md](Wiki/KNOWNISSUES.md) document for more information.
716+
- Read the [KNOWNISSUES.md](Wiki/KNOWNISSUES.md) document for more information.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Function Find-MSPages {
2+
<#
3+
.SYNOPSIS
4+
Find pages
5+
.DESCRIPTION
6+
Use this CMDlet to find all pages for specific criteria
7+
#>
8+
[Alias('Find-CMSPages')]
9+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
10+
param(
11+
[Parameter(
12+
Position = 0,
13+
Mandatory = $false,
14+
ParameterSetName = 'byMSSession'
15+
)]
16+
[array] $CategorySearchConfiguration = $null
17+
)
18+
begin {
19+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
20+
}
21+
process {
22+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
23+
Set-MSTimestamp;
24+
25+
$CategorySearchConfigurationString = ""
26+
27+
if ($null -ne $CategorySearchConfiguration)
28+
{
29+
foreach ($Configuration in $CategorySearchConfiguration)
30+
{
31+
$CategorySearchConfigurationString = ("<SEARCHITEM key='keyword' value='{0}' operator='{1}' />" -f $Configuration.CategoryGuid, $Configuration.Operator)
32+
}
33+
}
34+
35+
$Request = (
36+
"<IODATA loginguid='[!guid_login!]' sessionkey='[!key!]'>
37+
<PAGE action='xsearch'>
38+
<SEARCHITEMS>
39+
{0}
40+
</SEARCHITEMS>
41+
</PAGE>
42+
</IODATA>"
43+
) -f $CategorySearchConfigurationString;
44+
45+
$Request = Import-MSSessionProperties -Request ($Request);
46+
[xml]$Response = Invoke-MSRQLRequest -Request ($Request);
47+
48+
$Result = $Response.SelectNodes("IODATA/PAGES/PAGE");
49+
50+
Show-MSSessionWebServiceDebug;
51+
return $Result
52+
}
53+
end {
54+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
55+
}
56+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Function Get-MSPageInformationExtended {
2+
<#
3+
.SYNOPSIS
4+
Display additional data for a page
5+
.DESCRIPTION
6+
Display additional data for a page. Currently onl supports keywords as additional information
7+
#>
8+
[Alias('Get-CMSPageInformationExtended')]
9+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
10+
param(
11+
[Parameter(
12+
Position = 0,
13+
Mandatory = $true,
14+
ParameterSetName = 'byMSSession'
15+
)]
16+
[string] $PageGUID,
17+
[Parameter(
18+
Position = 1,
19+
Mandatory = $false,
20+
ParameterSetName = 'byMSSession'
21+
)]
22+
[Boolean] $Keywords = $false
23+
)
24+
begin {
25+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
26+
}
27+
process {
28+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
29+
Set-MSTimestamp;
30+
$Request = (
31+
"<IODATA loginguid='[!guid_login!]' sessionkey='[!key!]'>
32+
<PAGE action='load' guid='[!guid_page!]' option='extendedinfo'
33+
contentbased='0' keywords='{0}' recursive='0' cacheimageelements='0' />
34+
</IODATA>" -f (@{$true=1;$false=0}[$Keywords -eq $true])
35+
).Replace("[!guid_page!]", ($PageGUID|ConvertTo-RQLGuid));
36+
37+
$Request = Import-MSSessionProperties -Request ($Request);
38+
[xml]$Response = Invoke-MSRQLRequest -Request ($Request);
39+
40+
Show-MSSessionWebServiceDebug;
41+
return $Response;
42+
}
43+
end {
44+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
45+
}
46+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Function Get-MSPagePreview {
2+
<#
3+
.SYNOPSIS
4+
Retrieve a SmartEdit page preview.
5+
.DESCRIPTION
6+
Retrieve a SmartEdit page preview. The query returns the HTML source code for the preview (no IODATA element!).
7+
#>
8+
[Alias('Get-CMSPagePreview')]
9+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
10+
param(
11+
[Parameter(
12+
Position = 0,
13+
Mandatory = $false,
14+
ParameterSetName = 'byMSSession'
15+
)]
16+
[string] $PageGUID
17+
)
18+
begin {
19+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
20+
}
21+
process {
22+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
23+
Set-MSTimestamp;
24+
$Request = (
25+
"<IODATA loginguid='[!guid_login!]' sessionkey='[!guid_sessionkey!]'>
26+
<PREVIEW projectguid='[!guid_project!]' loginguid='[!guid_login!]'
27+
url='/CMS/ioRD.asp' querystring='Action=Preview&amp;Pageguid={0}' />
28+
</IODATA>"
29+
) -f $PageGUID
30+
31+
$Request = Import-MSSessionProperties -Request ($Request);
32+
[string] $Response = Invoke-MSRQLRequest -Request ($Request);
33+
34+
Show-MSSessionWebServiceDebug;
35+
return $Response;
36+
}
37+
end {
38+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
39+
}
40+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function Remove-MSPageCache
2+
{
3+
<#
4+
.SYNOPSIS
5+
List all pages
6+
.DESCRIPTION
7+
Use this CMDlet to list all pages of a project for the language variant used by the user executing the query.
8+
#>
9+
[Alias('Remove-CMSPageCache')]
10+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
11+
param(
12+
[Parameter(
13+
Position = 0,
14+
Mandatory = $true,
15+
ParameterSetName = 'byMSSession'
16+
)]
17+
[string[]] $PageGuids
18+
)
19+
begin {
20+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
21+
}
22+
process {
23+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
24+
Set-MSTimestamp;
25+
26+
$Request = (
27+
"<IODATA sessionkey='[!key!]' loginguid='[!guid_login!]'>
28+
<PAGEBUILDER languagevariantid='ENU'>
29+
<PAGES action='pagevaluesetdirty'>
30+
{0}
31+
</PAGES>
32+
</PAGEBUILDER>
33+
</IODATA>" -f ([System.String]::Concat(($PageGuids | ForEach-Object -Process {[System.String]::Format("<PAGE guid='{0}'/>", $_)})))
34+
);
35+
36+
$Request = Import-MSSessionProperties -Request ($Request);
37+
Invoke-MSRQLRequest -Request ($Request);
38+
39+
Show-MSSessionWebServiceDebug;
40+
}
41+
end {
42+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
43+
}
44+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
function Get-AllContentClassesInEditing
2+
{
3+
<#
4+
.SYNOPSIS
5+
Retrieves all content classes which are currently being edited
6+
.DESCRIPTION
7+
With this CMDlet you can get a report about which content classes are being edited and since when
8+
#>
9+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
10+
param(
11+
[Parameter(
12+
Position = 0,
13+
Mandatory = $false,
14+
ParameterSetName = 'byMSSession'
15+
)]
16+
[string] $ContentClassFolderGUID
17+
)
18+
begin {
19+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
20+
21+
Register-MSConfigStore;
22+
23+
Set-MSConfigDebugMode -Value ($false); # $true oder $false
24+
25+
Register-MSSession -UseDefaults ($true);
26+
Select-MSSession -UseDefaults ($true);
27+
Enter-MSSession -UseDefaults ($true);
28+
29+
Enter-MSProject -ProjectGUID (Get-MSSessionProperty -Name ("ProjectGUID")) | Out-Null;
30+
}
31+
process {
32+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
33+
34+
$AllContentClassesOfFolder = (Get-MSContentClasses -ContentClassFolderGUID ($ContentClassFolder.guid)).SelectNodes("IODATA/TEMPLATES/TEMPLATE");
35+
36+
$Result = @()
37+
foreach ($ContentClass in $AllContentClassesOfFolder) {
38+
$ContentClassProperties = Get-MSContentClassAllProperties -ContentClassGUID $ContentClass.guid
39+
$TemplateVariants = $ContentClassProperties.SelectNodes("IODATA/TEMPLATE/TEMPLATEVARIANTS")
40+
foreach ($TemplateVariant in $TemplateVariants)
41+
{
42+
if ($TemplateVariant.lock -eq "1")
43+
{
44+
foreach ($TemplateVariantAtom in $TemplateVariants.SelectNodes("TEMPLATEVARIANT"))
45+
{
46+
if ($TemplateVariantAtom.draft -eq "1")
47+
{
48+
# Using ordered so we can assure this is the correct order of attributes
49+
$ResultObject = [pscustomobject][ordered]@{
50+
ContentClassName = $ContentClass.name
51+
TemplateVariant = $TemplateVariantAtom.name
52+
Guid = $TemplateVariantAtom.guid
53+
Lockdate = $TemplateVariantAtom.changeddate | ConvertFrom-OADate
54+
Lockuser = $TemplateVariantAtom.changedusername
55+
}
56+
57+
$Result += $ResultObject
58+
}
59+
}
60+
}
61+
}
62+
}
63+
64+
return $Result
65+
}
66+
end {
67+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
68+
69+
Exit-MSSession -UseDefaults ($true);
70+
Unregister-MSSession -UseDefaults ($true);
71+
72+
Unregister-MSConfigStore;
73+
}
74+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
function Get-AllContentClassesWithNElements
2+
{
3+
<#
4+
.SYNOPSIS
5+
Retrieves all content classes which have more than a specific number of elements
6+
.DESCRIPTION
7+
Retrieves all content classes which have more than a specific number of elements
8+
#>
9+
[CmdletBinding(DefaultParameterSetName = 'byMSSession')]
10+
param(
11+
[Parameter(
12+
Position = 0,
13+
Mandatory = $false,
14+
ParameterSetName = 'byMSSession'
15+
)]
16+
[int] $ElementThreshold = 25
17+
)
18+
begin {
19+
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
20+
21+
Register-MSConfigStore;
22+
23+
Set-MSConfigDebugMode -Value ($false); # $true oder $false
24+
25+
Register-MSSession -UseDefaults ($true);
26+
Select-MSSession -UseDefaults ($true);
27+
Enter-MSSession -UseDefaults ($true);
28+
29+
Enter-MSProject -ProjectGUID (Get-MSSessionProperty -Name ("ProjectGUID")) | Out-Null;
30+
}
31+
process {
32+
Write-Debug -Message ("[ Process => function {0} ]" -f $MyInvocation.MyCommand);
33+
34+
$AllContentClassesOfFolder = (Get-MsContentClasses -ContentClassFolderGUID ($ContentClassFolder.guid)).SelectNodes("IODATA/TEMPLATES/TEMPLATE");
35+
36+
$Result = @()
37+
foreach ($ContentClass in $AllContentClassesOfFolder) {
38+
$ContentClassProperties = Get-MSContentClassAllProperties -ContentClassGUID $ContentClass.guid
39+
$Elements = $ContentClassProperties.SelectNodes("IODATA/TEMPLATE/ELEMENTS/ELEMENT")
40+
41+
if ($Elements.Count -lt $ElementThreshold)
42+
{
43+
continue;
44+
}
45+
46+
$ContentClassData = [pscustomobject][ordered]@{
47+
ContentClassName = $ContentClass.name
48+
ContentClassGuid = $ContentClass.guid
49+
ElementCount = $Elements.Count
50+
}
51+
52+
$Result += $ContentClassData
53+
}
54+
55+
return $Result
56+
}
57+
end {
58+
Write-Debug -Message ("[ Leave => function {0} ]" -f $MyInvocation.MyCommand);
59+
60+
Exit-MSSession -UseDefaults ($true);
61+
Unregister-MSSession -UseDefaults ($true);
62+
63+
Unregister-MSConfigStore;
64+
}
65+
}

0 commit comments

Comments
 (0)