updateinfo.php: Adjust for the new fileinfo db
This commit is contained in:
parent
0d06ee36f5
commit
6831bb17e9
@ -17,36 +17,10 @@ limitations under the License.
|
|||||||
|
|
||||||
require_once dirname(__FILE__).'/shared/main.php';
|
require_once dirname(__FILE__).'/shared/main.php';
|
||||||
require_once dirname(__FILE__).'/shared/cache.php';
|
require_once dirname(__FILE__).'/shared/cache.php';
|
||||||
|
require_once dirname(__FILE__).'/shared/fileinfo.php';
|
||||||
function uupApiPrivateGetFileinfo($updateId, $ignoreFiles) {
|
|
||||||
$cached = false;
|
|
||||||
|
|
||||||
if($ignoreFiles) {
|
|
||||||
$res = "fileinfo-fileless-$updateId";
|
|
||||||
$cache = new UupDumpCache($res, false);
|
|
||||||
$info = $cache->get();
|
|
||||||
$cached = ($info !== false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$cached) {
|
|
||||||
$info = @file_get_contents('fileinfo/'.$updateId.'.json');
|
|
||||||
if(empty($info)) return false;
|
|
||||||
$info = json_decode($info, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($ignoreFiles) {
|
|
||||||
if(isset($info['files'])) unset($info['files']);
|
|
||||||
|
|
||||||
if(!$cached) {
|
|
||||||
$cache->put($info, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
function uupUpdateInfo($updateId, $onlyInfo = 0, $ignoreFiles = false) {
|
function uupUpdateInfo($updateId, $onlyInfo = 0, $ignoreFiles = false) {
|
||||||
$info = uupApiPrivateGetFileinfo($updateId, $ignoreFiles);
|
$info = uupApiReadFileinfo($updateId, $ignoreFiles);
|
||||||
if($info === false) {
|
if($info === false) {
|
||||||
return ['error' => 'UPDATE_INFORMATION_NOT_EXISTS'];
|
return ['error' => 'UPDATE_INFORMATION_NOT_EXISTS'];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user