Skip to content

Commit 2629569

Browse files
Rename directories to align with better practices (#8737)
1 parent 84dacdb commit 2629569

File tree

918 files changed

+86
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

918 files changed

+86
-49
lines changed

dbatools.psm1

+44-10
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ whether the modulebase has been set (first thing it does after loading library t
6969
Theoretically, there's a minor cuncurrency collision risk with that, but since the cost is only
7070
a little import time loss if that happens ...
7171
#>
72-
Import-Command -Path "$script:psScriptRoot/internal/scripts/libraryimport.ps1"
72+
Import-Command -Path "$script:psScriptRoot/private/scripts/libraryimport.ps1"
7373
Write-ImportTime -Text "Initial import of SMO libraries"
7474

7575
Import-Command -Path "$psScriptRoot/bin/typealiases.ps1"
@@ -168,14 +168,14 @@ Write-ImportTime -Text "Checking for debugging preference"
168168

169169
if (-not (Test-Path -Path "$psScriptRoot\dbatools.dat") -or $script:serialimport) {
170170
# All internal functions privately available within the toolset
171-
foreach ($file in (Get-ChildItem -Path "$psScriptRoot/internal/functions/" -Recurse -Filter *.ps1)) {
171+
foreach ($file in (Get-ChildItem -Path "$psScriptRoot/private/functions/" -Recurse -Filter *.ps1)) {
172172
. $file.FullName
173173
}
174174

175175
Write-ImportTime -Text "Loading internal commands via dotsource"
176176

177177
# All exported functions
178-
foreach ($file in (Get-ChildItem -Path "$script:PSModuleRoot/functions/" -Recurse -Filter *.ps1)) {
178+
foreach ($file in (Get-ChildItem -Path "$script:PSModuleRoot/public/" -Recurse -Filter *.ps1)) {
179179
. $file.FullName
180180
}
181181

@@ -187,7 +187,7 @@ if (-not (Test-Path -Path "$psScriptRoot\dbatools.dat") -or $script:serialimport
187187

188188
# Load configuration system - Should always go after library and path setting
189189
# this has its own Write-ImportTimes
190-
Import-Command -Path "$psScriptRoot/internal/configurations/configuration.ps1"
190+
Import-Command -Path "$psScriptRoot/private/configurations/configuration.ps1"
191191

192192
# Resolving the path was causing trouble when it didn't exist yet
193193
# Not converting the path separators based on OS was also an issue.
@@ -201,33 +201,33 @@ if (-not ([Dataplat.Dbatools.Message.LogHost]::LoggingPath)) {
201201
# Validations were moved into the other files, in order to prevent having to update dbatools.psm1 every time
202202

203203
if ($PSVersionTable.PSVersion.Major -lt 5) {
204-
foreach ($file in (Get-ChildItem -Path "$script:PSScriptRoot/optional" -Filter *.ps1)) {
204+
foreach ($file in (Get-ChildItem -Path "$script:PSScriptRoot/opt" -Filter *.ps1)) {
205205
Import-Command -Path $file.FullName
206206
}
207207
Write-ImportTime -Text "Loading Optional Commands"
208208
}
209209

210210
# Process TEPP parameters
211-
Import-Command -Path "$psScriptRoot/internal/scripts/insertTepp.ps1"
211+
Import-Command -Path "$psScriptRoot/private/scripts/insertTepp.ps1"
212212
Write-ImportTime -Text "Loading TEPP"
213213

214214
# Process transforms
215-
Import-Command -Path "$psScriptRoot/internal/scripts/message-transforms.ps1"
215+
Import-Command -Path "$psScriptRoot/private/scripts/message-transforms.ps1"
216216
Write-ImportTime -Text "Loading Message Transforms"
217217

218218
# Load scripts that must be individually run at the end #
219219
#-------------------------------------------------------#
220220

221221
# Start the logging system (requires the configuration system up and running)
222-
Import-Command -Path "$psScriptRoot/internal/scripts/logfilescript.ps1"
222+
Import-Command -Path "$psScriptRoot/private/scripts/logfilescript.ps1"
223223
Write-ImportTime -Text "Loading Script: Logging"
224224

225225
# Start the tepp asynchronous update system (requires the configuration system up and running)
226-
Import-Command -Path "$psScriptRoot/internal/scripts/updateTeppAsync.ps1"
226+
Import-Command -Path "$psScriptRoot/private/scripts/updateTeppAsync.ps1"
227227
Write-ImportTime -Text "Loading Script: Asynchronous TEPP Cache"
228228

229229
# Start the maintenance system (requires pretty much everything else already up and running)
230-
Import-Command -Path "$psScriptRoot/internal/scripts/dbatools-maintenance.ps1"
230+
Import-Command -Path "$psScriptRoot/private/scripts/dbatools-maintenance.ps1"
231231
Write-ImportTime -Text "Loading Script: Maintenance"
232232

233233
# New 3-char aliases
@@ -1024,4 +1024,38 @@ Write-ImportTime -Text "Checking for some ISE stuff"
10241024
# Create collection for servers
10251025
$script:connectionhash = @{ }
10261026

1027+
1028+
if (Get-DbatoolsConfigValue -FullName Import.EncryptionMessageCheck) {
1029+
$trustcert = Get-DbatoolsConfigValue -FullName sql.connection.trustcert
1030+
$encrypt = Get-DbatoolsConfigValue -FullName sql.connection.encrypt
1031+
if (-not $trustcert -or $encrypt -in "Mandatory", "$true") {
1032+
# keep it write-host for psv3
1033+
Write-Message -Level Output -Message '
1034+
/ / / /
1035+
| O | | O |
1036+
| |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -| |
1037+
| O | | O |
1038+
| | | |
1039+
| O | | O |
1040+
| | C O M P U T E R | |
1041+
| O | | O |
1042+
| | M E S S A G E | |
1043+
| O | | O |
1044+
| | | |
1045+
| O |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -| O |
1046+
| | | |
1047+
1048+
Microsoft changed the encryption defaults in their SqlClient library, which may
1049+
cause your connections to fail.
1050+
1051+
You can change the defaults with Set-DbatoolsConfig but dbatools also makes it
1052+
easy to setup encryption. Check out dbatools.io/newdefaults for more information.
1053+
1054+
To disable this message, run:
1055+
1056+
Set-DbatoolsConfig -Name Import.EncryptionMessageCheck -Value $false -PassThru |
1057+
Register-DbatoolsConfig'
1058+
}
1059+
}
1060+
10271061
[Dataplat.Dbatools.dbaSystem.SystemHost]::ModuleImported = $true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/configurations/configuration.ps1 private/configurations/configuration.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ if (($PSVersionTable.PSVersion.Major -ge 6) -and ($PSVersionTable.OS -notlike "*
140140
$script:NoRegistry = $true
141141
}
142142

143-
$configpath = [IO.Path]::Combine($script:PSModuleRoot, "internal", "configurations")
143+
$configpath = [IO.Path]::Combine($script:PSModuleRoot, "private", "configurations")
144144
Write-ImportTime -Text "Config system: Set more paths and special paths"
145145
# Import configuration validation
146146
foreach ($file in (Get-ChildItem -Path ([IO.Path]::Combine($configpath, "validation")))) {

internal/configurations/settings/import.ps1 private/configurations/settings/import.ps1

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,7 @@ Set-DbatoolsConfig -Name 'Import.SerialImport' -Value $false -Initialize -Valida
7171
} -Description "Enabling this will cause the module to perform import in a serial manner, not parallelizing anything. This will impose a significant delay on import, but reduces the CPU impact during import. Setting this for an unattended script may be useful to avoid resource alerts. Can be set on script level by placing the following code in the first line: '`$dbatools_serialimport = `$true'. This configuration setting persists across all PowerShell consoles for this user."
7272

7373
# Check for SqlPs
74-
Set-DbatoolsConfig -Name 'Import.SqlpsCheck' -Value $true -Initialize -Validation bool -Description "Does not warn about sqlps being imported at the time of the dbatools import"
74+
Set-DbatoolsConfig -Name 'Import.SqlpsCheck' -Value $true -Initialize -Validation bool -Description "Does not warn about sqlps being imported at the time of the dbatools import"
75+
76+
# Check for Encryption
77+
Set-DbatoolsConfig -Name 'Import.EncryptionMessageCheck' -Value $true -Initialize -Validation bool -Description "Does not warn about new Microsoft encryption defaults"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/functions/Get-DbaHelp.ps1 private/functions/Get-DbaHelp.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function Get-DbaHelp {
198198
}
199199
$null = $rtn.Add('')
200200
$null = $rtn.Add("`n" + ' ' + "`n")
201-
$null = $rtn.Add('Want to see the source code for this command? Check out [' + $doc_to_render.CommandName + '](https://github.com/dataplat/dbatools/blob/master/functions/' + $doc_to_render.CommandName + '.ps1) on GitHub.')
201+
$null = $rtn.Add('Want to see the source code for this command? Check out [' + $doc_to_render.CommandName + '](https://github.com/dataplat/dbatools/blob/master/public/' + $doc_to_render.CommandName + '.ps1) on GitHub.')
202202
$null = $rtn.Add("<br>")
203203
$null = $rtn.Add('Want to see the Bill Of Health for this command? Check out [' + $doc_to_render.CommandName + '](https://dataplat.github.io/boh#' + $doc_to_render.CommandName + ').')
204204
$null = $rtn.Add('')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/functions/Invoke-TagCommand.ps1 private/functions/Invoke-TagCommand.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Invoke-TagCommand ([string]$Tag, [string]$Keyword) {
2727
$tagsRex = ([regex]'(?m)^[\s]{0,15}Tags:(.*)$')
2828
$modulepath = (Get-Module -Name dbatools).Path
2929
$directory = Split-Path $modulepath
30-
$basedir = "$directory\functions\"
30+
$basedir = "$directory\public\"
3131
Import-Module $modulepath -force
3232
$allfiles = Get-ChildItem $basedir
3333
foreach ($f in $allfiles) {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/maintenance/teppInsertTask.ps1 private/maintenance/teppInsertTask.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
$scriptBlock = {
22
$ModuleRoot = [Dataplat.Dbatools.dbaSystem.SystemHost]::ModuleBase
33

4-
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path "$ModuleRoot\internal\functions\tabcompletion\Register-DbaTeppScriptblock.ps1").ProviderPath))), $null, $null)
5-
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path "$ModuleRoot\internal\functions\tabcompletion\Register-DbaTeppInstanceCacheBuilder.ps1").ProviderPath))), $null, $null)
4+
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path "$ModuleRoot\private\functions\tabcompletion\Register-DbaTeppScriptblock.ps1").ProviderPath))), $null, $null)
5+
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path "$ModuleRoot\private\functions\tabcompletion\Register-DbaTeppInstanceCacheBuilder.ps1").ProviderPath))), $null, $null)
66

7-
foreach ($file in (Get-ChildItem (Resolve-Path "$ModuleRoot\internal\dynamicparams\*.ps1").ProviderPath)) {
7+
foreach ($file in (Get-ChildItem (Resolve-Path "$ModuleRoot\private\dynamicparams\*.ps1").ProviderPath)) {
88
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($file.FullName))), $null, $null)
99
}
1010

File renamed without changes.

internal/scripts/dbatools-maintenance.ps1 private/scripts/dbatools-maintenance.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
foreach ($item in (Get-ChildItem "$script:PSModuleRoot\internal\maintenance" -Filter *.ps1)) {
1+
foreach ($item in (Get-ChildItem "$script:PSModuleRoot\private\maintenance" -Filter *.ps1)) {
22
if ($script:serialimport) {
33
. $item.FullName
44
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)