Skip to content

Commit a031972

Browse files
committed
DOTNET-2368 Fix PR review and add project inclusion for publishing targets
1 parent 4b04c75 commit a031972

3 files changed

Lines changed: 17 additions & 25 deletions

File tree

Public/Publication/Publication-Targets/Get-MSPublicationTargetData.ps1

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
Listing Publication Packages
55
.DESCRIPTION
66
You can list all existing publication packages in a project with name and GUID.
7-
.EXAMPLE
8-
... {EXAMPLE} ...
9-
.INPUTS
10-
... {INPUTS} ...
11-
.OUTPUTS
12-
... {OUTPUTS} ...
13-
.LINK
14-
... {LINK} ...
157
.NOTES
168
RQL: Listing Publication Packages, Software version >= 5.0
179
#>

Public/Publication/Publication-Targets/Get-MSPublishingTargets.ps1

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
Listing publishing targets
55
.DESCRIPTION
66
You can list all existing publishing targets in a project with name, GUID, path and type
7-
.EXAMPLE
8-
... {EXAMPLE} ...
9-
.INPUTS
10-
... {INPUTS} ...
11-
.OUTPUTS
12-
... {OUTPUTS} ...
13-
.LINK
14-
... {LINK} ...
157
.NOTES
168
RQL: Listing publishing targets, Software version >= 5.0
179
#>

Scripts/Maintenance/Set-PublishingTargets.ps1

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
)]
3838
[string[]] $ReplaceStrings,
3939
# The new targets need names that can identify the them, so we don't reuse the same name as the outdated target
40-
# Please note, that this array must be size 1 our the same count as replace strings, otherwise an error will be thrown
40+
# Please note, that this array must be size 1 or the same count as ReplaceStrings, otherwise an error will be thrown
4141
#>
4242
[Parameter(
4343
Position = 3,
@@ -53,7 +53,15 @@
5353
Mandatory = $false,
5454
ParameterSetName = 'byMSSession'
5555
)]
56-
[string[]] $Fingerprints
56+
[string[]] $Fingerprints,
57+
# If included an given, the replacemenet will only be done in the projects with the given name
58+
#>
59+
[Parameter(
60+
Position = 5,
61+
Mandatory = $false,
62+
ParameterSetName = 'byMSSession'
63+
)]
64+
[string[]] $InProjects
5765
)
5866
begin {
5967
Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand);
@@ -82,18 +90,16 @@
8290
foreach ($Project in $Projects)
8391
{
8492
$ProjectName = $Project.name
85-
# TODO - Remove start
86-
if ($ProjectName -ne "FastTrackTest1")
93+
if ($InProjects.Length -gt 0 -and $InProjects.Contains($ProjectName))
8794
{
8895
continue
8996
}
90-
# TODO - Remove end
9197

9298
$Report.Add($ProjectName, @())
9399

94100
# Inhibitlevel tells us about the lock level of the system and
95101
# -1 stands for "Locked to all users including Server Manager"
96-
# so since we can't access the projec tanyway, we can skip it.
102+
# so since we can't access the project anyway, we can skip it.
97103
if ($Project.inhibitlevel -eq -1) {
98104
$Report[$ProjectName] += "Project is locked. Skipping..."
99105
continue;
@@ -108,11 +114,13 @@
108114
$OutDatedTargetGuid = $null
109115
# This map will hold information about the target (url) and the GUID the target will have
110116
$NewTargets = @{}
111-
# Whereas this map will hold information about the target (url) and whether there exists a publication combination already
117+
# Whereas this map will hold information about the target (url) and whether there exists a publication
118+
# combination already
112119
$PublicationCombinationMap = @{}
113120
foreach ($ReplaceString in $ReplaceStrings)
114121
{
115-
# This is just a map for better performance when
122+
# This is just a map for better performance when going over the same target that doesn't need
123+
# replacing multiple times, so we don't iterate over it more than once.
116124
$NewTargets.Add($ReplaceString, $null);
117125
$PublicationCombinationMap.Add($ReplaceString, $false);
118126
}
@@ -251,7 +259,7 @@
251259
}
252260
}
253261

254-
$Report[$ProjectName] += "Added $AddedCounter new combinations in this project"
262+
# $Report[$ProjectName] += "Added $AddedCounter new combinations in this project"
255263
}
256264

257265
return $Report

0 commit comments

Comments
 (0)