forked from uup-dump/api
listid.php: Adjust for the new fileinfo database
This commit is contained in:
parent
76092ff092
commit
0d06ee36f5
17
listid.php
17
listid.php
@ -17,6 +17,7 @@ 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 uupApiPrivateInvalidateFileinfoCache() {
|
function uupApiPrivateInvalidateFileinfoCache() {
|
||||||
$cache1 = new UupDumpCache('listid-0', false);
|
$cache1 = new UupDumpCache('listid-0', false);
|
||||||
@ -27,18 +28,19 @@ function uupApiPrivateInvalidateFileinfoCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uupApiPrivateGetFromFileinfo($sortByDate = 0) {
|
function uupApiPrivateGetFromFileinfo($sortByDate = 0) {
|
||||||
if(!file_exists('fileinfo')) return false;
|
$dirs = uupApiGetFileinfoDirs();
|
||||||
|
$fileinfo = $dirs['fileinfoData'];
|
||||||
|
$fileinfoRoot = $dirs['fileinfo'];
|
||||||
|
|
||||||
$files = scandir('fileinfo');
|
$files = scandir($fileinfo);
|
||||||
$files = preg_grep('/\.json$/', $files);
|
$files = preg_grep('/\.json$/', $files);
|
||||||
|
|
||||||
consoleLogger('Parsing database info...');
|
consoleLogger('Parsing database info...');
|
||||||
|
|
||||||
$cacheFile = 'fileinfo/?cache.json';
|
$cacheFile = $fileinfoRoot.'/cache.json';
|
||||||
$cacheV2Version = 1;
|
$cacheV2Version = 1;
|
||||||
|
|
||||||
$database = @file_get_contents($cacheFile);
|
$database = uupApiReadJson($cacheFile);
|
||||||
$database = json_decode($database, true);
|
|
||||||
|
|
||||||
if(isset($database['version'])) {
|
if(isset($database['version'])) {
|
||||||
$version = $database['version'];
|
$version = $database['version'];
|
||||||
@ -57,14 +59,13 @@ function uupApiPrivateGetFromFileinfo($sortByDate = 0) {
|
|||||||
$newDb = array();
|
$newDb = array();
|
||||||
$builds = array();
|
$builds = array();
|
||||||
foreach($files as $file) {
|
foreach($files as $file) {
|
||||||
if($file == '.' || $file == '..' || $file == '?cache.json')
|
if($file == '.' || $file == '..')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$uuid = preg_replace('/\.json$/', '', $file);
|
$uuid = preg_replace('/\.json$/', '', $file);
|
||||||
|
|
||||||
if(!isset($database[$uuid])) {
|
if(!isset($database[$uuid])) {
|
||||||
$info = @file_get_contents('fileinfo/'.$file);
|
$info = uupApiReadFileinfoMeta($uuid);
|
||||||
$info = json_decode($info, true);
|
|
||||||
|
|
||||||
$title = isset($info['title']) ? $info['title'] : 'UNKNOWN';
|
$title = isset($info['title']) ? $info['title'] : 'UNKNOWN';
|
||||||
$build = isset($info['build']) ? $info['build'] : 'UNKNOWN';
|
$build = isset($info['build']) ? $info['build'] : 'UNKNOWN';
|
||||||
|
Loading…
Reference in New Issue
Block a user