Setup/DBCReader

* port extended client file handling from other branch
 * class DBC -> DBCReader now initializes a DBCFile
   which itself is a BinaryFile
 * update DBCReader to use the new DB wrappers multi-insert feature
This commit is contained in:
Sarjuuk 2026-01-19 22:34:59 +01:00
parent 69df50619a
commit c85675e181
11 changed files with 766 additions and 524 deletions

View file

@ -62,10 +62,10 @@ CLISetup::registerSetup("sql", new class extends SetupScript
// .mp3 => audio/mpeg
$query =
'SELECT `id` AS `id`, `type` AS `cat`, `name`, 0 AS `cuFlags`,
`file1` AS `soundFile1`, `file2` AS `soundFile2`, `file3` AS `soundFile3`, `file4` AS `soundFile4`, `file5` AS `soundFile5`,
`file6` AS `soundFile6`, `file7` AS `soundFile7`, `file8` AS `soundFile8`, `file9` AS `soundFile9`, `file10` AS `soundFile10`,
`path`, `flags`
'SELECT `id` AS "id", `type` AS "cat", `name`, 0 AS "cuFlags",
`file1` AS "soundFile1", `file2` AS "soundFile2", `file3` AS "soundFile3", `file4` AS "soundFile4", `file5` AS "soundFile5",
`file6` AS "soundFile6", `file7` AS "soundFile7", `file8` AS "soundFile8", `file9` AS "soundFile9", `file10` AS "soundFile10",
IFNULL(`path`, "") AS "path", `flags`
FROM dbc_soundentries
LIMIT %i, %i';
@ -95,6 +95,9 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$hasDupes = false;
for ($i = 1; $i < 11; $i++)
{
if (!$s['soundFile'.$i])
continue;
$nicePath = CLI::nicePath($s['soundFile'.$i], $s['path']);
if ($s['soundFile'.$i] && array_key_exists($nicePath, $soundIndex))
{
@ -134,9 +137,6 @@ CLISetup::registerSetup("sql", new class extends SetupScript
CLI::write('[sound] Group '.str_pad('['.$s['id'].']', 7).' '.CLI::bold($s['name']).' has invalid sound file '.CLI::bold($s['soundFile'.$i]).' on index '.$i.'! Skipping...', CLI::LOG_WARN);
$s['soundFile'.$i] = null;
}
// empty case
else
$s['soundFile'.$i] = null;
}
if (!$fileSets && !$hasDupes)