forked from uup-dump/api
Save cache only after successful retrieval, better token generation
This commit is contained in:
24
get.php
24
get.php
@ -273,19 +273,6 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests) {
|
||||
$postData = composeFileGetRequest($updateId, uupDevice(), $info, $rev);
|
||||
$out = sendWuPostRequest('https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured', $postData);
|
||||
consoleLogger('Information has been successfully fetched.');
|
||||
|
||||
if($cacheRequests == 1) {
|
||||
$cache = array(
|
||||
'expires' => time()+90,
|
||||
'content' => $out,
|
||||
'fetchTime' => $fetchTime,
|
||||
);
|
||||
|
||||
if(!file_exists('cache')) mkdir('cache');
|
||||
@file_put_contents('cache/'.$cacheHash.'.json.gz', gzencode(json_encode($cache)."\n"));
|
||||
|
||||
unset($cache);
|
||||
}
|
||||
}
|
||||
|
||||
consoleLogger('Parsing information...');
|
||||
@ -365,6 +352,17 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests) {
|
||||
}
|
||||
}
|
||||
|
||||
if($cacheRequests == 1) {
|
||||
$cache = array(
|
||||
'expires' => time()+90,
|
||||
'content' => $out,
|
||||
'fetchTime' => $fetchTime,
|
||||
);
|
||||
|
||||
if(!file_exists('cache')) mkdir('cache');
|
||||
@file_put_contents('cache/'.$cacheHash.'.json.gz', gzencode(json_encode($cache)."\n"));
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user