Added support of downloading WindowsUpdateBox.exe file only

This commit is contained in:
mkuba50 2018-03-17 22:20:20 +01:00
parent 9b861d4492
commit 3f6d6dcbe0
2 changed files with 50 additions and 32 deletions

80
get.php
View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
Copyright 2017 UUP dump API authors Copyright 2018 UUP dump API authors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -71,32 +71,37 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
} }
$desiredEdition = strtoupper($desiredEdition); $desiredEdition = strtoupper($desiredEdition);
if($desiredEdition && $desiredEdition != 'UPDATEONLY') {
if(!$usePack) {
return array('error' => 'UNSPECIFIED_LANG');
}
if(!isset($editionPacks[$desiredEdition])) { switch($desiredEdition) {
return array('error' => 'UNSUPPORTED_EDITION'); case 0: break;
} case 'WUBFILE': break;
$supported = 0; case 'UPDATEONLY':
foreach($packsForLangs[$usePack] as $val) { if(!isset($info['containsCU']) || !$info['containsCU']) {
if($editionPacks[$desiredEdition] == $val) $supported = 1; return array('error' => 'NOT_CUMULATIVE_UPDATE');
} }
break;
if(!$supported) { default:
return array('error' => 'UNSUPPORTED_COMBINATION'); if(!$usePack) {
} return array('error' => 'UNSPECIFIED_LANG');
unset($supported); }
if(!isset($editionPacks[$desiredEdition])) {
return array('error' => 'UNSUPPORTED_EDITION');
}
$checkEditions = array($desiredEdition); $supported = 0;
} foreach($packsForLangs[$usePack] as $val) {
if($editionPacks[$desiredEdition] == $val) $supported = 1;
}
if($desiredEdition == 'UPDATEONLY') { if(!$supported) {
if(!isset($info['containsCU']) || !$info['containsCU']) { return array('error' => 'UNSUPPORTED_COMBINATION');
return array('error' => 'NOT_CUMULATIVE_UPDATE'); }
} unset($supported);
$checkEditions = array($desiredEdition);
break;
} }
$rev = 1; $rev = 1;
@ -215,20 +220,33 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
unset($removeFiles); unset($removeFiles);
$filesKeys = array_keys($files); $filesKeys = array_keys($files);
if($desiredEdition == 'UPDATEONLY') {
$removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
foreach($removeFiles as $val) { switch($desiredEdition) {
if(isset($files[$val])) unset($files[$val]); case 'UPDATEONLY':
} $skipPackBuild = 1;
$removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
unset($removeFiles, $temp); foreach($removeFiles as $val) {
$filesKeys = array_keys($files); if(isset($files[$val])) unset($files[$val]);
}
$filesKeys = preg_grep('/Windows10\.0-KB/i', $filesKeys); unset($removeFiles, $temp);
$filesKeys = array_keys($files);
$filesKeys = preg_grep('/Windows10\.0-KB/i', $filesKeys);
break;
case 'WUBFILE':
$skipPackBuild = 1;
$filesKeys = preg_grep('/WindowsUpdateBox.exe/i', $filesKeys);
break;
default:
$skipPackBuild = 0;
break;
} }
if($usePack && $desiredEdition != 'UPDATEONLY') { if($usePack && !$skipPackBuild) {
$esd = array_keys($files); $esd = array_keys($files);
$esd = preg_grep('/\.esd$/i', $esd); $esd = preg_grep('/\.esd$/i', $esd);

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
function uupApiVersion() { function uupApiVersion() {
return '1.10.3'; return '1.11.0';
} }
function uupApiPrintBrand() { function uupApiPrintBrand() {