
&"$PSScriptRoot\vars.ps1"

Write-Error ""
Write-Error "This script is for new installs ONLY!"
Write-Error ""

$confirmation = Read-Host "Are you REALLY sure you want to run this!?  (y): "
if (-Not ($confirmation -eq 'y')) {
    exit
}

&"$ROOT/Scripts/version.ps1"
&"$ROOT/Scripts/fresh-iis.ps1"
&"$ROOT/Scripts/fresh-files.ps1"
&"$ROOT/Scripts/fresh-tasks.ps1"
&"$ROOT/Scripts/fresh-db.ps1"

$confirmation = Read-Host "Have you run the 'fresh.cedar.sql', 'fresh.cisa.sql' and 1 - 3 SQL scripts (in this directory) against the relevant databases ? (y): "
if (-Not ($confirmation -eq 'y')) {
    exit
}

&"$ROOT/Scripts/connection.ps1"
&"$ROOT/Scripts/permissions.ps1"

&"$ROOT/Scripts/init-prod.ps1"

&"$PHPexe" "$ROOT\Scripts\upgradeCommand.php" upgrade:check --verbose

&"$PHPexe" "$ROOT/src/bootstrap.php" "upgrade:db:sync"
&"$PHPexe" "$ROOT/src/bootstrap.php" "upgrade:patch"

&"$PHPexe" "$ROOT/src/bootstrap.php" "release:notify"

&"$PHPexe" "$ROOT/src/bootstrap.php" "test:storage"

Write-Host "Install Complete"

