beginTransaction(); $removed = DemoDataService::reset($db); DemoDataService::seed($db, null); $db->commit(); DemoDataService::clearFiles(); DemoDataService::installFiles($db); fwrite(STDOUT, json_encode(['ok'=>true,'backup'=>$backup['name'],'removed'=>$removed], JSON_UNESCAPED_UNICODE) . PHP_EOL); } catch (Throwable $e) { if ($db->inTransaction()) $db->rollBack(); fwrite(STDERR, json_encode(['ok'=>false,'error'=>$e->getMessage()], JSON_UNESCAPED_UNICODE) . PHP_EOL); exit(1); }