Last active
November 2, 2017 11:00
-
-
Save patrickperrone/59b8745ee8b8ff9045b5 to your computer and use it in GitHub Desktop.
Revisions
-
patrickperrone revised this gist
May 19, 2017 . 1 changed file with 11 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,9 @@ function Get-ConfigFileFilter([string]$providerName) { return "^.*\." + $providerName + "\.(.+\.)?config.*$" } function Set-SCSearchProvider { $rootPath = Read-Host "What is the path of your Sitecore instance's website folder?"; $choice = Read-Host "(L)ucene or (S)olr?"; @@ -34,9 +39,9 @@ Function Set-SCSearchProvider $deselectedProvider = "Lucene"; } #enumerate all config files to be enabled $regexp = Get-ConfigFileFilter $selectedProvider $filesToEnable = Get-ChildItem -Recurse -File -Path $rootPath | Where-Object { $_.FullName -match $regexp } foreach ($file in $filesToEnable) { Write-Host $file.Name; @@ -49,8 +54,8 @@ Function Set-SCSearchProvider } #enumerate all config files to be disabled $regexp = Get-ConfigFileFilter $deselectedProvider $filesToDisable = Get-ChildItem -Recurse -File -Path $rootPath | Where-Object { $_.FullName -match $regexp } foreach ($file in $filesToDisable) { Write-Host $file.Name; -
patrickperrone revised this gist
Mar 23, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,7 @@ Function Set-SCSearchProvider } #enumerate all config files to be enabled $filter = "*." + $selectedProvider + ".*config*"; $filesToEnable = Get-ChildItem -Recurse -File -Path $rootPath -Filter $filter; foreach ($file in $filesToEnable) { -
patrickperrone revised this gist
Jul 5, 2015 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Function Set-SCSearchProvider { $rootPath = Read-Host "What is the path of your Sitecore instance's website folder?"; $choice = Read-Host "(L)ucene or (S)olr?"; @@ -23,13 +23,13 @@ Function Change-SCSearchProvider { If (($choice -eq "L")) { Write-Host "Set to Lucene." -ForegroundColor Yellow; $selectedProvider = "Lucene"; $deselectedProvider = "Solr"; } ElseIf (($choice -eq "S")) { Write-Host "Set to Solr." -ForegroundColor Yellow; $selectedProvider = "Solr"; $deselectedProvider = "Lucene"; } @@ -64,4 +64,4 @@ Function Change-SCSearchProvider } } Set-SCSearchProvider -
patrickperrone revised this gist
Mar 12, 2015 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ Function Change-SCSearchProvider { $rootPath = Read-Host "What is the path of your Sitecore instance's website folder?"; @@ -38,7 +36,7 @@ Function Change-SCSearchProvider #enumerate all config files to be enabled $filter = "*" + $selectedProvider + "*.config*"; $filesToEnable = Get-ChildItem -Recurse -File -Path $rootPath -Filter $filter; foreach ($file in $filesToEnable) { Write-Host $file.Name; @@ -52,7 +50,7 @@ Function Change-SCSearchProvider #enumerate all config files to be disabled $filter = "*" + $deselectedProvider + "*.config*"; $filesToDisable = Get-ChildItem -Recurse -File -Path $rootPath -Filter $filter; foreach ($file in $filesToDisable) { Write-Host $file.Name; @@ -64,4 +62,6 @@ Function Change-SCSearchProvider } } } } Change-SCSearchProvider -
patrickperrone created this gist
Mar 8, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ Change-SCSearchProvider Function Change-SCSearchProvider { $rootPath = Read-Host "What is the path of your Sitecore instance's website folder?"; $choice = Read-Host "(L)ucene or (S)olr?"; $validInput = $true; #test that path is valid If (!(Test-Path -Path $rootPath)) { Write-Host "The supplied path was invalid or inaccessible." -ForegroundColor Red; $validInput = $false; } #test that choice is valid ElseIf (($choice -ne "L") -and ($choice -ne "S")) { Write-Host "You must choose L or S." -ForegroundColor Red; $validInput = $false; } If ($validInput) { If (($choice -eq "L")) { Write-Host "Change to Lucene." -ForegroundColor Yellow; $selectedProvider = "Lucene"; $deselectedProvider = "Solr"; } ElseIf (($choice -eq "S")) { Write-Host "Change to Solr." -ForegroundColor Yellow; $selectedProvider = "Solr"; $deselectedProvider = "Lucene"; } #enumerate all config files to be enabled $filter = "*" + $selectedProvider + "*.config*"; $filesToEnable = Get-ChildItem –Recurse -File -Path $rootPath -Filter $filter; foreach ($file in $filesToEnable) { Write-Host $file.Name; if (($file.Extension -ne ".config")) { $newFileName = [io.path]::GetFileNameWithoutExtension($file.FullName); $newFile = Rename-Item -Path $file.FullName -NewName $newFileName -PassThru; Write-Host "-> " $newFile.Name -ForegroundColor Green; } } #enumerate all config files to be disabled $filter = "*" + $deselectedProvider + "*.config*"; $filesToDisable = Get-ChildItem –Recurse -File -Path $rootPath -Filter $filter; foreach ($file in $filesToDisable) { Write-Host $file.Name; if ($file.Extension -eq ".config") { $newFileName = $file.Name + ".disabled"; $newFile = Rename-Item -Path $file.FullName -NewName $newFileName -PassThru; Write-Host "-> " $newFile.Name -ForegroundColor Green; } } } }