Return if there are additional updates to integrate

This commit is contained in:
eraseyourknees@gmail.com 2022-08-25 03:59:37 +02:00
parent 16d048df08
commit 12db118aae

18
get.php
View File

@ -142,6 +142,7 @@ function uupGetFiles(
$updateBuild = (isset($info['build'])) ? $info['build'] : 'UNKNOWN'; $updateBuild = (isset($info['build'])) ? $info['build'] : 'UNKNOWN';
$updateName = (isset($info['title'])) ? $info['title'] : 'Unknown update: '.$updateId; $updateName = (isset($info['title'])) ? $info['title'] : 'Unknown update: '.$updateId;
$sha256capable = isset($info['sha256ready']); $sha256capable = isset($info['sha256ready']);
$hasUpdates = false;
if(isset($info['releasetype'])) { if(isset($info['releasetype'])) {
$type = $info['releasetype']; $type = $info['releasetype'];
@ -215,6 +216,7 @@ function uupGetFiles(
unset($index, $name, $msu); unset($index, $name, $msu);
$filesInfoKeys = array_keys($filesInfoList); $filesInfoKeys = array_keys($filesInfoList);
$updatesRegex = '/Windows(10|11)\.0-KB|SSU-.*?\....$/i';
switch($fileListSource) { switch($fileListSource) {
case 'UPDATEONLY': case 'UPDATEONLY':
@ -227,8 +229,8 @@ function uupGetFiles(
unset($removeFiles); unset($removeFiles);
foreach($removeMSUs as $val) { foreach($removeMSUs as $val) {
if(isset($filesInfoList[$val.'.cab'])) { if(isset($filesInfoList[$val.'.cab']) && isset($filesInfoList[$val.'.msu'])) {
if(isset($filesInfoList[$val.'.msu'])) unset($filesInfoList[$val.'.msu']); unset($filesInfoList[$val.'.msu']);
} }
} }
unset($removeMSUs); unset($removeMSUs);
@ -236,13 +238,14 @@ function uupGetFiles(
$filesInfoKeys = array_keys($filesInfoList); $filesInfoKeys = array_keys($filesInfoList);
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $filesInfoKeys); $temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $filesInfoKeys);
$filesInfoKeys = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$/i', $filesInfoKeys); $filesInfoKeys = preg_grep($updatesRegex, $filesInfoKeys);
if(count($filesInfoKeys) == 0) { if(count($filesInfoKeys) == 0) {
return array('error' => 'NOT_CUMULATIVE_UPDATE'); return array('error' => 'NOT_CUMULATIVE_UPDATE');
} }
if($build > 21380) $filesInfoKeys = array_merge($filesInfoKeys, $temp); if($build > 21380) $filesInfoKeys = array_merge($filesInfoKeys, $temp);
unset($temp); unset($temp);
$hasUpdates = true;
break; break;
case 'WUBFILE': case 'WUBFILE':
@ -257,8 +260,8 @@ function uupGetFiles(
if($fileListSource == 'GENERATEDPACKS') { if($fileListSource == 'GENERATEDPACKS') {
foreach($removeMSUs as $val) { foreach($removeMSUs as $val) {
if(isset($filesInfoList[$val.'.cab'])) { if(isset($filesInfoList[$val.'.cab']) && isset($filesInfoList[$val.'.msu'])) {
if(isset($filesInfoList[$val.'.msu'])) unset($filesInfoList[$val.'.msu']); unset($filesInfoList[$val.'.msu']);
} }
} }
unset($removeMSUs); unset($removeMSUs);
@ -270,8 +273,10 @@ function uupGetFiles(
} else if($build > 21380) { } else if($build > 21380) {
$temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp); $temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
} else { } else {
$temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$/i', $temp); $temp = preg_grep($updatesRegex, $temp);
} }
$hasUpdates = !empty(preg_grep($updatesRegex, $temp));
$filesPacksList = array_merge($filesPacksList, $temp); $filesPacksList = array_merge($filesPacksList, $temp);
$newFiles = array(); $newFiles = array();
@ -337,6 +342,7 @@ function uupGetFiles(
'arch' => $updateArch, 'arch' => $updateArch,
'build' => $updateBuild, 'build' => $updateBuild,
'sku' => $updateSku, 'sku' => $updateSku,
'hasUpdates' => $hasUpdates,
'files' => $files, 'files' => $files,
); );
} }