listeditions.php cleanup
This commit is contained in:
parent
954547ea84
commit
5777ff09b6
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Copyright 2022 UUP dump API authors
|
Copyright 2023 UUP dump API authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -17,60 +17,35 @@ limitations under the License.
|
|||||||
|
|
||||||
require_once dirname(__FILE__).'/shared/main.php';
|
require_once dirname(__FILE__).'/shared/main.php';
|
||||||
require_once dirname(__FILE__).'/shared/packs.php';
|
require_once dirname(__FILE__).'/shared/packs.php';
|
||||||
require_once dirname(__FILE__).'/updateinfo.php';
|
|
||||||
|
|
||||||
function uupListEditions($lang = 'en-us', $updateId = 0) {
|
function uupListEditions($lang = 'en-us', $updateId = 0) {
|
||||||
if($updateId) {
|
|
||||||
$info = uupUpdateInfo($updateId, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$lang) {
|
if(!$lang) {
|
||||||
return array('error' => 'UNSUPPORTED_LANG');
|
return array('error' => 'UNSUPPORTED_LANG');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($info['info'])) $info = $info['info'];
|
|
||||||
|
|
||||||
if(isset($info['build'])) {
|
|
||||||
$build = explode('.', $info['build']);
|
|
||||||
$build = $build[0];
|
|
||||||
} else {
|
|
||||||
$build = 15063;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isset($info['arch'])) {
|
|
||||||
$info['arch'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
|
|
||||||
$fancyTexts = uupGetInfoTexts();
|
|
||||||
$fancyEditionNames = $fancyTexts['fancyEditionNames'];
|
|
||||||
|
|
||||||
if($lang) {
|
|
||||||
$lang = strtolower($lang);
|
$lang = strtolower($lang);
|
||||||
|
$genPack = uupApiGetPacks($updateId);
|
||||||
|
$fancyEditionNames = uupGetInfoTexts()['fancyEditionNames'];
|
||||||
|
|
||||||
if(!isset($genPack[$lang])) {
|
if(!isset($genPack[$lang])) {
|
||||||
return array('error' => 'UNSUPPORTED_LANG');
|
return array('error' => 'UNSUPPORTED_LANG');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$editionList = array();
|
$editionList = [];
|
||||||
$editionListFancy = array();
|
$editionListFancy = [];
|
||||||
|
|
||||||
foreach(array_keys($genPack[$lang]) as $edition) {
|
foreach(array_keys($genPack[$lang]) as $edition) {
|
||||||
if($edition == 'LXP') continue;
|
if(in_array($edition, ['LXP', 'FOD'])) continue;
|
||||||
if($edition == 'FOD') continue;
|
|
||||||
|
|
||||||
if(isset($fancyEditionNames[$edition])) {
|
$fancyName = isset($fancyEditionNames[$edition]) ? $fancyEditionNames[$edition] : $edition;
|
||||||
$fancyName = $fancyEditionNames[$edition];
|
|
||||||
} else {
|
|
||||||
$fancyName = $edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
$editionList[] = $edition;
|
$editionList[] = $edition;
|
||||||
$editionListFancy[$edition] = $fancyName;
|
$editionListFancy[$edition] = $fancyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'apiVersion' => uupApiVersion(),
|
'apiVersion' => uupApiVersion(),
|
||||||
'editionList' => $editionList,
|
'editionList' => $editionList,
|
||||||
'editionFancyNames' => $editionListFancy,
|
'editionFancyNames' => $editionListFancy,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user