Update get_zip_meta to include database export files

This commit is contained in:
2025-09-25 16:03:35 +02:00
parent e09b3f4b18
commit a3b639a7d9

View File

@@ -24,11 +24,11 @@ function get_zip_meta($path): array {
$name1 = fread($fp, 7);
fseek($fp, $extraFieldLen1, SEEK_CUR);
$data1 = fread($fp, unpack("V", substr($zipHdr1, 18, 4))[1]);
if ($name1 !== "version" || !str_starts_with($data1, "elwig:")) {
if ($name1 !== "version" || (!str_starts_with($data1, "elwig:") && !str_starts_with($data1, "elwig-db:"))) {
fclose($fp);
return array($meta, null, null);
}
$version = (int)substr($data1, 6);
$version = $data1;
$zipHdr2 = fread($fp, 30);
if (strlen($zipHdr2) !== 30 || !str_starts_with($zipHdr2, "PK\x03\x04") ||
@@ -198,7 +198,7 @@ foreach ($clients as $c) {
}
$version ??= "null";
echo " {\"name\": \"$file\", \"timestamp\": $datetime, \"zwstid\": $zwstid, \"meta\": $meta, \"files\": $files, " .
"\"version\": $version, \"url\": \"$url\", \"size\": $size, \"created\": \"$cre\", \"modified\": \"$mod\"}";
"\"version\": \"$version\", \"url\": \"$url\", \"size\": $size, \"created\": \"$cre\", \"modified\": \"$mod\"}";
$first = false;
}
echo "\n]}\n";