forked from uup-dump/api
Fixed a bug when using uupGetFiles more than one time
This commit is contained in:
parent
c6ebd7e73f
commit
6eaa55dad1
39
get.php
39
get.php
@ -22,22 +22,6 @@ require_once dirname(__FILE__).'/shared/packs.php';
|
|||||||
function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePack = 0, $desiredEdition = 0) {
|
function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePack = 0, $desiredEdition = 0) {
|
||||||
uupApiPrintBrand();
|
uupApiPrintBrand();
|
||||||
|
|
||||||
function packsByEdition($edition, $pack, $lang, $filesKeys) {
|
|
||||||
$filesTemp = array();
|
|
||||||
|
|
||||||
if($edition != 'editionNeutral') {
|
|
||||||
$temp = preg_grep('/'.$edition.'_'.$lang.'\.esd/i', $filesKeys);
|
|
||||||
$filesTemp = array_merge($filesTemp, $temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($pack as $val) {
|
|
||||||
$temp = preg_grep('/'.$val.'.*/i', $filesKeys);
|
|
||||||
$filesTemp = array_merge($filesTemp, $temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $filesTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
$info = @file_get_contents('fileinfo/'.$updateId.'.json');
|
$info = @file_get_contents('fileinfo/'.$updateId.'.json');
|
||||||
if(empty($info)) {
|
if(empty($info)) {
|
||||||
$info = array(
|
$info = array(
|
||||||
@ -78,8 +62,6 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
|||||||
|
|
||||||
$desiredEdition = strtoupper($desiredEdition);
|
$desiredEdition = strtoupper($desiredEdition);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch($desiredEdition) {
|
switch($desiredEdition) {
|
||||||
case '0': break;
|
case '0': break;
|
||||||
case 'WUBFILE': break;
|
case 'WUBFILE': break;
|
||||||
@ -108,8 +90,6 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
|||||||
}
|
}
|
||||||
unset($supported);
|
unset($supported);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($skipLangPack[$desiredEdition])) {
|
if(isset($skipLangPack[$desiredEdition])) {
|
||||||
if($skipLangPack[$desiredEdition]) {
|
if($skipLangPack[$desiredEdition]) {
|
||||||
$noLangPack = 1;
|
$noLangPack = 1;
|
||||||
@ -144,7 +124,7 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
|||||||
consoleLogger('Fetching information from the server...');
|
consoleLogger('Fetching information from the server...');
|
||||||
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
|
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
|
||||||
$out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
$out = sendWuPostRequest('https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
||||||
consoleLogger('Information was successfully fetched.');
|
consoleLogger('Information has been successfully fetched.');
|
||||||
|
|
||||||
consoleLogger('Parsing information...');
|
consoleLogger('Parsing information...');
|
||||||
preg_match_all('/<FileLocation>.*?<\/FileLocation>/', $out, $out);
|
preg_match_all('/<FileLocation>.*?<\/FileLocation>/', $out, $out);
|
||||||
@ -311,7 +291,6 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
|||||||
$filesKeys = array_keys($files);
|
$filesKeys = array_keys($files);
|
||||||
$filesTemp = array();
|
$filesTemp = array();
|
||||||
|
|
||||||
|
|
||||||
if(!$noLangPack) {
|
if(!$noLangPack) {
|
||||||
$temp = preg_grep('/.*'.$usePack.'-Package.*/i', $filesKeys);
|
$temp = preg_grep('/.*'.$usePack.'-Package.*/i', $filesKeys);
|
||||||
$filesTemp = array_merge($filesTemp, $temp);
|
$filesTemp = array_merge($filesTemp, $temp);
|
||||||
@ -356,4 +335,20 @@ function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePac
|
|||||||
'files' => $files,
|
'files' => $files,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function packsByEdition($edition, $pack, $lang, $filesKeys) {
|
||||||
|
$filesTemp = array();
|
||||||
|
|
||||||
|
if($edition != 'editionNeutral') {
|
||||||
|
$temp = preg_grep('/'.$edition.'_'.$lang.'\.esd/i', $filesKeys);
|
||||||
|
$filesTemp = array_merge($filesTemp, $temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($pack as $val) {
|
||||||
|
$temp = preg_grep('/'.$val.'.*/i', $filesKeys);
|
||||||
|
$filesTemp = array_merge($filesTemp, $temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filesTemp;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function uupApiVersion() {
|
function uupApiVersion() {
|
||||||
return '1.13.2';
|
return '1.13.3';
|
||||||
}
|
}
|
||||||
|
|
||||||
function uupApiPrintBrand() {
|
function uupApiPrintBrand() {
|
||||||
|
Loading…
Reference in New Issue
Block a user