$body['usernamePrefix'] ?? 'dev_', 'clientCodePrefix' => $body['clientCodePrefix'] ?? 'DEV-CL-', ]); qdb_save($tmpDb, $lockFp); json_success($result); } if ($action === 'wipeExceptAdmins') { $result = qdb_wipe_all_data_except_admins($pdo); qdb_save($tmpDb, $lockFp); json_success($result); } $fixture = $body['fixture'] ?? null; if (!is_array($fixture)) { qdb_discard($tmpDb, $lockFp); json_error('MISSING_FIELDS', 'fixture object is required for import', 400); } $result = qdb_import_dev_fixture($pdo, $fixture); qdb_save($tmpDb, $lockFp); json_success($result); } catch (Throwable $e) { if (isset($tmpDb, $lockFp)) { qdb_discard($tmpDb, $lockFp); } $labels = [ 'remove' => 'Remove', 'wipeExceptAdmins' => 'Wipe', 'import' => 'Import', ]; $label = $labels[$action ?? 'import'] ?? 'Operation'; error_log("dev fixture $label: " . $e->getMessage()); json_error('SERVER_ERROR', "$label failed: " . $e->getMessage(), 500); }