Adding support for wildcard in app id

pull/571/head
romanitho 2024-02-21 23:26:51 +01:00
parent 98e5c5392e
commit 52ad20adad
1 changed files with 24 additions and 13 deletions

View File

@ -292,14 +292,20 @@ if (Test-Network) {
if ($UseWhiteList) { if ($UseWhiteList) {
#For each app, notify and update #For each app, notify and update
foreach ($app in $outdated) { foreach ($app in $outdated) {
if (($toUpdate -contains $app.Id) -and $($app.Version) -ne "Unknown") { #if current app version is unknown, skip it
Update-App $app if ($($app.Version) -eq "Unknown") {
}
#if current app version is unknown
elseif ($($app.Version) -eq "Unknown") {
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray"
} }
#if app is in "excluded list" #if app is in "include list", update it
elseif ($toUpdate -contains $app.Id) {
Update-App $app
}
#if app with wildcard is in "include list", update it
elseif ($toUpdate | Where-Object { $app.Id -like $_ }) {
Write-ToLog "$($app.Name) is wildcard in the include list."
Update-App $app
}
#else, skip it
else { else {
Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray"
} }
@ -309,17 +315,22 @@ if (Test-Network) {
else { else {
#For each app, notify and update #For each app, notify and update
foreach ($app in $outdated) { foreach ($app in $outdated) {
if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne "Unknown") { #if current app version is unknown, skip it
Update-App $app if ($($app.Version) -eq "Unknown") {
}
#if current app version is unknown
elseif ($($app.Version) -eq "Unknown") {
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray"
} }
#if app is in "excluded list" #if app is in "excluded list", skip it
else { elseif ($toSkip -contains $app.Id) {
Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray"
} }
#if app with wiladcard is in "excluded list", skip it
elseif ($toSkip | Where-Object { $app.Id -like $_ }) {
Write-ToLog "$($app.Name) : Skipped upgrade because it is *wildcard* in the excluded app list" "Gray"
}
# else, update it
else {
Update-App $app
}
} }
} }