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

40
get.php
View File

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

View File

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