Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,17 @@ jobs:
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
Set-Service wuauserv -StartupType Manual
$webConfig = "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config"
$content = Get-Content $webConfig -Raw
$content = $content.Replace(
"<configuration>",
"<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>"
)
$content = $content.Replace(
"`t</system.webServer>",
"`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>"
)
[xml]$webConfigXml = Get-Content $webConfig -Raw
$configuration = $webConfigXml.SelectSingleNode('/configuration')
$systemWebServer = $webConfigXml.SelectSingleNode('/configuration/system.webServer')
$systemWeb = $webConfigXml.CreateElement('system.web')
$customErrors = $webConfigXml.CreateElement('customErrors')
$customErrors.SetAttribute('mode', 'Off')
[void]$systemWeb.AppendChild($customErrors)
[void]$configuration.InsertBefore($systemWeb, $systemWebServer)
$httpErrors = $webConfigXml.CreateElement('httpErrors')
$httpErrors.SetAttribute('errorMode', 'Detailed')
[void]$systemWebServer.AppendChild($httpErrors)
$rewriteInstalled = $false
try {
choco install urlrewrite -y --no-progress
Expand All @@ -714,9 +716,12 @@ jobs:
Write-Warning "URL Rewrite installation failed; continuing without rewrite-specific IIS configuration."
}
if (-not $rewriteInstalled) {
$content = $content -replace "(?s)`r?`n\s*<rewrite>.*?</rewrite>", ""
$rewrite = $webConfigXml.SelectSingleNode('/configuration/system.webServer/rewrite')
if ($null -ne $rewrite) {
[void]$systemWebServer.RemoveChild($rewrite)
}
}
Set-Content $webConfig -Value $content -Encoding UTF8
$webConfigXml.Save($webConfig)
Import-Module WebAdministration
New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB3\phpBB" -Force
$session = Get-PSSession -Name WinPSCompatSession
Expand All @@ -728,7 +733,7 @@ jobs:
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";%windir%\system32\inetsrv")
echo Setup FAST-CGI configuration
Add-WebConfiguration -Filter /system.webServer/fastCgi -PSPath IIS:\ -Value @{fullpath="C:\tools\php\php-cgi.exe"}
echo Setup FACT-CGI handler
echo Setup FAST-CGI handler
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
iisreset
NET START W3SVC
Expand Down