Skip to content

Commit 5bb68c8

Browse files
authored
Merge pull request #79 from iMattPro/fix-master
Merge 3.3.x branch into master
2 parents 12628a4 + 86336e9 commit 5bb68c8

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,27 @@ jobs:
720720
run: |
721721
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
722722
Set-Service wuauserv -StartupType Manual
723-
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB4\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB4\phpBB\web.config
724-
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB4\phpBB\web.config).replace("`t</system.webServer>", "`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB4\phpBB\web.config
725-
choco install urlrewrite -y
723+
$webConfig = "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config"
724+
$content = Get-Content $webConfig -Raw
725+
$content = $content.Replace(
726+
"<configuration>",
727+
"<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>"
728+
)
729+
$content = $content.Replace(
730+
"`t</system.webServer>",
731+
"`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>"
732+
)
733+
$rewriteInstalled = $false
734+
try {
735+
choco install urlrewrite -y --no-progress
736+
$rewriteInstalled = $true
737+
} catch {
738+
Write-Warning "URL Rewrite installation failed; continuing without rewrite-specific IIS configuration."
739+
}
740+
if (-not $rewriteInstalled) {
741+
$content = $content -replace "(?s)`r?`n\s*<rewrite>.*?</rewrite>", ""
742+
}
743+
Set-Content $webConfig -Value $content -Encoding UTF8
726744
Import-Module WebAdministration
727745
New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB4\phpBB" -Force
728746
$session = Get-PSSession -Name WinPSCompatSession

0 commit comments

Comments
 (0)