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); $packs = uupGetPacks($build);
$packsForLangs = $packs['packsForLangs']; $packsForLangs = $packs['packsForLangs'];
$editionPacks = $packs['editionPacks']; $editionPacks = $packs['editionPacks'];
$checkEditions = $packs['allEditions'];
$packs = $packs['packs']; $packs = $packs['packs'];
if($usePack) { if($usePack) {
@ -88,6 +89,8 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
return array('error' => 'UNSUPPORTED_COMBINATION'); return array('error' => 'UNSUPPORTED_COMBINATION');
} }
unset($supported); unset($supported);
$checkEditions = array($desiredEdition);
} }
if($desiredEdition == 'UPDATEONLY') { if($desiredEdition == 'UPDATEONLY') {
@ -226,6 +229,24 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
} }
if($usePack && $desiredEdition != 'UPDATEONLY') { 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 = array();
$removeFiles[0] = preg_grep('/RetailDemo-OfflineContent/i', $filesKeys); $removeFiles[0] = preg_grep('/RetailDemo-OfflineContent/i', $filesKeys);
$removeFiles[1] = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys); $removeFiles[1] = preg_grep('/Windows10\.0-KB.*-EXPRESS/i', $filesKeys);

View File

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

View File

@ -57,6 +57,90 @@ function uupGetPacks($build = 15063) {
'zh-tw' => 'Chinese (Traditional)', 'zh-tw' => 'Chinese (Traditional)',
); );
$allEditions = array(
'ANALOGONECORE',
'CORE',
'CORECOUNTRYSPECIFIC',
'COREN',
'CORESINGLELANGUAGE',
'CORESYSTEMSERVER',
'EDUCATION',
'EDUCATIONN',
'EMBEDDED',
'EMBEDDEDE',
'EMBEDDEDEEVAL',
'EMBEDDEDEVAL',
'ENTERPRISE',
'ENTERPRISEEVAL',
'ENTERPRISEG',
'ENTERPRISEGN',
'ENTERPRISEN',
'ENTERPRISENEVAL',
'ENTERPRISES',
'ENTERPRISESEVAL',
'ENTERPRISESN',
'ENTERPRISESNEVAL',
'IOTUAP',
'PPIPRO',
'PROFESSIONAL',
'PROFESSIONALCOUNTRYSPECIFIC',
'PROFESSIONALEDUCATION',
'PROFESSIONALEDUCATIONN',
'PROFESSIONALN',
'PROFESSIONALSINGLELANGUAGE',
'PROFESSIONALWORKSTATION',
'PROFESSIONALWORKSTATIONN',
'SERVERARM64',
'SERVERARM64CORE',
'SERVERAZURECOR',
'SERVERAZURECORCORE',
'SERVERAZURENANO',
'SERVERAZURENANOCORE',
'SERVERCLOUDSTORAGE',
'SERVERCLOUDSTORAGECORE',
'SERVERDATACENTER',
'SERVERDATACENTERACOR',
'SERVERDATACENTERACORCORE',
'SERVERDATACENTERCOR',
'SERVERDATACENTERCORCORE',
'SERVERDATACENTERCORE',
'SERVERDATACENTEREVAL',
'SERVERDATACENTEREVALCOR',
'SERVERDATACENTEREVALCORCORE',
'SERVERDATACENTEREVALCORE',
'SERVERDATACENTERNANO',
'SERVERDATACENTERNANOCORE',
'SERVERHYPERCORE',
'SERVERRDSH',
'SERVERRDSHCORE',
'SERVERSOLUTION',
'SERVERSOLUTIONCORE',
'SERVERSTANDARD',
'SERVERSTANDARDACOR',
'SERVERSTANDARDACORCORE',
'SERVERSTANDARDCOR',
'SERVERSTANDARDCORCORE',
'SERVERSTANDARDCORE',
'SERVERSTANDARDEVAL',
'SERVERSTANDARDEVALCOR',
'SERVERSTANDARDEVALCORCORE',
'SERVERSTANDARDEVALCORE',
'SERVERSTANDARDNANO',
'SERVERSTANDARDNANOCORE',
'SERVERSTORAGESTANDARD',
'SERVERSTORAGESTANDARDCORE',
'SERVERSTORAGESTANDARDEVAL',
'SERVERSTORAGESTANDARDEVALCORE',
'SERVERSTORAGEWORKGROUP',
'SERVERSTORAGEWORKGROUPCORE',
'SERVERSTORAGEWORKGROUPEVAL',
'SERVERSTORAGEWORKGROUPEVALCORE',
'SERVERWEB',
'SERVERWEBCORE',
'STARTER',
'STARTERN',
);
if($build < 17063) { if($build < 17063) {
require dirname(__FILE__).'/packs/legacy.php'; require dirname(__FILE__).'/packs/legacy.php';
} elseif ($build >= 17063) { } elseif ($build >= 17063) {
@ -69,6 +153,7 @@ function uupGetPacks($build = 15063) {
'editionPacks' => $editionPacks, 'editionPacks' => $editionPacks,
'fancyEditionNames' => $fancyEditionNames, 'fancyEditionNames' => $fancyEditionNames,
'fancyLangNames' => $fancyLangNames, 'fancyLangNames' => $fancyLangNames,
'allEditions' => $allEditions,
); );
} }
?> ?>