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); ksort($shaArray);
$temp = array( $temp = array();
'title' => $updateTitle, $temp['title'] = $updateTitle;
'ring' => $ring, $temp['ring'] = $ring;
'flight' => $flight, $temp['flight'] = $flight;
'arch' => $arch, $temp['arch'] = $arch;
'build' => $foundBuild, $temp['build'] = $foundBuild;
'checkBuild' => $build, $temp['checkBuild'] = $build;
'files' => $shaArray,
); if(preg_match('/Cumulative Update/', $updateTitle)) {
$temp['containsCU'] = 1;
}
$temp['files'] = $shaArray;
consoleLogger('Successfully parsed the information.'); consoleLogger('Successfully parsed the information.');
consoleLogger('Writing new build information to the disk...'); consoleLogger('Writing new build information to the disk...');

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

View File

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

View File

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