Add checking if metadata ESD files exist

This commit is contained in:
mkuba50
2017-12-24 22:23:18 +01:00
parent 77745105e1
commit d196812ce8
3 changed files with 107 additions and 1 deletions

21
get.php
View File

@ -60,6 +60,7 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
$packs = uupGetPacks($build);
$packsForLangs = $packs['packsForLangs'];
$editionPacks = $packs['editionPacks'];
$checkEditions = $packs['allEditions'];
$packs = $packs['packs'];
if($usePack) {
@ -88,6 +89,8 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
return array('error' => 'UNSUPPORTED_COMBINATION');
}
unset($supported);
$checkEditions = array($desiredEdition);
}
if($desiredEdition == 'UPDATEONLY') {
@ -226,6 +229,24 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
}
if($usePack && $desiredEdition != 'UPDATEONLY') {
$esd = array_keys($files);
$esd = preg_grep('/\.esd$/i', $esd);
foreach($esd as $key => $val) {
$esd[$key] = strtoupper($val);
}
foreach($checkEditions as $val) {
$testEsd[] = $val.'_'.strtoupper($usePack).'.ESD';
}
$foundMetadata = array_intersect($testEsd, $esd);
consoleLogger('Found '.count($foundMetadata).' metadata ESD file(s).');
if(empty($foundMetadata)) {
return array('error' => 'NO_METADATA_ESD');
}
$removeFiles = array();
$removeFiles[0] = preg_grep('/RetailDemo-OfflineContent/i', $filesKeys);
$removeFiles[1] = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);