From 15b42f35d0e65ebb0788fc20145c03f0954f5431 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 23 Feb 2014 22:46:04 +0100 Subject: tools/recount-bumps.php: initial commit --- tools/recount-bumps.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tools/recount-bumps.php (limited to '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"); -- cgit v1.3 From d274180f81d50fbb378ada700b1814d6ed163ed6 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 23 Feb 2014 22:53:41 +0100 Subject: recount-bumps.txt: a small fix --- tools/recount-bumps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/recount-bumps.php') diff --git a/tools/recount-bumps.php b/tools/recount-bumps.php index 633ce4da..5adc74d8 100644 --- a/tools/recount-bumps.php +++ b/tools/recount-bumps.php @@ -25,7 +25,7 @@ while ($val = $q->fetch()) { $f = $lc->fetch(); if ($val['bump'] != $f['aq']) { - $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump`=$f[aq] + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump`=:bump WHERE `id`=:id", $board)); $query->bindValue(":bump", $f['aq']); $query->bindValue(":id", $val['id']); -- cgit v1.3