Add support for Cumulative Updates

This commit is contained in:
mkuba50 2017-10-16 18:03:26 +02:00
parent 2f2e532dae
commit d1df967ded
4 changed files with 43 additions and 16 deletions

View File

@ -144,15 +144,19 @@ function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build
ksort($shaArray);
$temp = array(
'title' => $updateTitle,
'ring' => $ring,
'flight' => $flight,
'arch' => $arch,
'build' => $foundBuild,
'checkBuild' => $build,
'files' => $shaArray,
);
$temp = array();
$temp['title'] = $updateTitle;
$temp['ring'] = $ring;
$temp['flight'] = $flight;
$temp['arch'] = $arch;
$temp['build'] = $foundBuild;
$temp['checkBuild'] = $build;
if(preg_match('/Cumulative Update/', $updateTitle)) {
$temp['containsCU'] = 1;
}
$temp['files'] = $shaArray;
consoleLogger('Successfully parsed the information.');
consoleLogger('Writing new build information to the disk...');

32
get.php
View File

@ -45,12 +45,12 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
}
}
if($desiredEdition) {
$desiredEdition = strtoupper($desiredEdition);
if($desiredEdition && $desiredEdition != 'UPDATEONLY') {
if(!$usePack) {
return array('error' => 'UNSPECIFIED_LANG');
}
$desiredEdition = strtoupper($desiredEdition);
if(!isset($editionPacks[$desiredEdition])) {
return array('error' => 'UNSUPPORTED_EDITION');
}
@ -78,6 +78,12 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$info = json_decode($info, true);
}
if($desiredEdition == 'UPDATEONLY') {
if(!isset($info['containsCU']) || !$info['containsCU']) {
return array('error' => 'NOT_CUMULATIVE_UPDATE');
}
}
$uupFix = 0;
if(isset($info['needsFix'])) {
if($info['needsFix'] == true) $uupFix = 1;
@ -150,8 +156,10 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$files = array_merge($files, array($name => $temp));
}
} else {
$name = preg_replace('/\.psf$/', '', $name);
$removeFiles = array_merge($removeFiles, array($name));
if(!preg_match('/^Windows10\.0-KB/', $name)) {
$name = preg_replace('/\.psf$/', '', $name);
$removeFiles = array_merge($removeFiles, array($name));
}
}
}
@ -176,8 +184,22 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$filesKeys = array_keys($files);
}
if($usePack) {
if($desiredEdition == 'UPDATEONLY') {
$removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
foreach($removeFiles as $val) {
if(isset($files[$val])) unset($files[$val]);
}
unset($removeFiles, $temp);
$filesKeys = array_keys($files);
$filesKeys = preg_grep('/Windows10\.0-KB/i', $filesKeys);
}
if($usePack && $desiredEdition != 'UPDATEONLY') {
$removeFiles = preg_grep('/RetailDemo-OfflineContent/i', $filesKeys);
$removeFiles = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);
foreach($removeFiles as $val) {
if(isset($files[$val])) unset($files[$val]);

View File

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

View File

@ -37,6 +37,7 @@ $packs = array(
'Microsoft-Windows-Hello-Face-Resource-A-Package',
'Microsoft-Windows-Hello-Face-Resource-B-Package',
'Microsoft-OneCore-ApplicationModel-Sync-Desktop-FOD-Package',
'Windows10\.0-KB',
),
'CLOUD' => array(
'Microsoft-Windows-EditionPack-Professional-Package',