From 15b42f35d0e65ebb0788fc20145c03f0954f5431 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 23 Feb 2014 22:46:04 +0100 Subject: [PATCH] tools/recount-bumps.php: initial commit --- tools/recount-bumps.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tools/recount-bumps.php diff --git a/tools/recount-bumps.php b/tools/recount-bumps.php new file mode 100644 index 00000000..633ce4da --- /dev/null +++ b/tools/recount-bumps.php @@ -0,0 +1,39 @@ +fetch()) { + $lc = prepare(sprintf('SELECT MAX(`time`) AS `aq` FROM ``posts_%s`` + WHERE ((`thread` = :thread and + `email` != "sage" ) OR `id` = :thread', $board)); + + $lc->bindValue(":thread", $val['id']); + $lc->execute(); + + $f = $lc->fetch(); + if ($val['bump'] != $f['aq']) { + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump`=$f[aq] + WHERE `id`=:id", $board)); + $query->bindValue(":bump", $f['aq']); + $query->bindValue(":id", $val['id']); + echo("Thread $val[id] - to be $val[bump] -> $f[aq]\n"); + } + else { + echo("Thread $val[id] ok\n"); + } +} + +echo("done\n");