From 71c6978b735ed748998bc57dbf64056923980b9d Mon Sep 17 00:00:00 2001 From: Spine Date: Sun, 13 Jun 2021 22:18:30 +0000 Subject: [PATCH] add a script to regen all torrent filelists --- scripts/regen-filelists.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/regen-filelists.php diff --git a/scripts/regen-filelists.php b/scripts/regen-filelists.php new file mode 100644 index 000000000..699025e82 --- /dev/null +++ b/scripts/regen-filelists.php @@ -0,0 +1,35 @@ +scalar("SELECT MAX(ID) FROM torrents"); +$id = 0; + +while ($id < $max) { + $id++; + $DB->prepared_query(" + SELECT ID + FROM torrents + WHERE ID >= ? + ORDER BY ID + LIMIT ? + ", $id, 1000); + $list = $DB->collect(0); + foreach ($list as $id) { + try { + $torMan->regenerateFilelist($id); + } catch (RuntimeException $e) { + echo "$id: fail: " . $e->getMessage() . "\n"; + } + } +}