forked from uup-dump/api
Change handling of packs
The handling of packs has been changed to use different files for builds. This will allow easier implementation of changed packs in future.
This commit is contained in:
53
get.php
53
get.php
@ -17,9 +17,9 @@ limitations under the License.
|
||||
|
||||
require_once dirname(__FILE__).'/shared/main.php';
|
||||
require_once dirname(__FILE__).'/shared/requests.php';
|
||||
require_once dirname(__FILE__).'/shared/packs.php';
|
||||
|
||||
function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePack = 0, $desiredEdition = 0) {
|
||||
require dirname(__FILE__).'/shared/packs.php';
|
||||
uupApiPrintBrand();
|
||||
|
||||
function packsByEdition($edition, $pack, $lang, $filesKeys) {
|
||||
@ -38,6 +38,30 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
||||
return $filesTemp;
|
||||
}
|
||||
|
||||
$info = @file_get_contents('fileinfo/'.$updateId.'.json');
|
||||
if(empty($info)) {
|
||||
$info = array(
|
||||
'ring' => 'WIF',
|
||||
'flight' => 'Active',
|
||||
'checkBuild' => '10.0.16251.0',
|
||||
'files' => array(),
|
||||
);
|
||||
} else {
|
||||
$info = json_decode($info, true);
|
||||
}
|
||||
|
||||
if(isset($info['build'])) {
|
||||
$build = explode('.', $info['build']);
|
||||
$build = $build[0];
|
||||
} else {
|
||||
$build = 9841;
|
||||
}
|
||||
|
||||
$packs = uupGetPacks($build);
|
||||
$packsForLangs = $packs['packsForLangs'];
|
||||
$editionPacks = $packs['editionPacks'];
|
||||
$packs = $packs['packs'];
|
||||
|
||||
if($usePack) {
|
||||
$usePack = strtolower($usePack);
|
||||
if(!isset($packsForLangs[$usePack])) {
|
||||
@ -66,33 +90,6 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
||||
unset($supported);
|
||||
}
|
||||
|
||||
$info = @file_get_contents('fileinfo/'.$updateId.'.json');
|
||||
if(empty($info)) {
|
||||
$info = array(
|
||||
'ring' => 'WIF',
|
||||
'flight' => 'Active',
|
||||
'checkBuild' => '10.0.16251.0',
|
||||
'files' => array(),
|
||||
);
|
||||
} else {
|
||||
$info = json_decode($info, true);
|
||||
}
|
||||
|
||||
if(isset($info['build'])) {
|
||||
$build = explode('.', $info['build']);
|
||||
$build = $build[0];
|
||||
} else {
|
||||
$build = 9841;
|
||||
}
|
||||
|
||||
if($build >= 17063) {
|
||||
$packs = $packs17063;
|
||||
|
||||
if(isset($editionMap[$desiredEdition])) {
|
||||
$desiredEdition = $editionMap[$desiredEdition];
|
||||
}
|
||||
}
|
||||
|
||||
if($desiredEdition == 'UPDATEONLY') {
|
||||
if(!isset($info['containsCU']) || !$info['containsCU']) {
|
||||
return array('error' => 'NOT_CUMULATIVE_UPDATE');
|
||||
|
Reference in New Issue
Block a user