think tank forum

ttf development » number of threads, thread count

dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
total threads from main page: 2681
https://www.thinktankforums.com/thread.php?thread_id=2688

i was going to make a thread link randomizer and i saw that the number differs from the total. is this a known behavior? is the post total dynamically calculated each page load?
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
it seems to be the case (on page load), but the total is off.
asemisldkfj's avatar
13 years ago
link
asemisldkfj
the law is no protection
archived threads? do those exist?
lucas's avatar
13 years ago
link
lucas
i ❤ demo
lucas@www:~$ cat sql.php
<?php

$id_start = 1;
$id_end = 2690;

echo <<<ABC
CREATE TABLE `enum` (
    `id` INT NOT NULL ,
    PRIMARY KEY ( `id` )
);



INSERT INTO `enum` ( `id` ) VALUES
ABC;

for ($i=$id_start; $i<=$id_end; $i++) {
    echo ($i===$id_start) ? "($i)" : ", ($i)";
};

echo <<<ABC
;


SELECT `enum`.`id`
FROM `enum`
LEFT JOIN `ttf_thread`
  ON `ttf_thread`.`thread_id`=`enum`.`id`
WHERE `ttf_thread`.`thread_id` IS NULL;

DROP TABLE `enum`;

ABC;

lucas@www:~$ php sql.php > go.sql
lucas@www:~$ mysql -p thinktankforums-com < go.sql > results.txt
Enter password:
lucas@www:~$ cat results.txt
id
20
31
156
399
622
623
624
1965
lucas@www:~$
lucas's avatar
13 years ago
link
lucas
i ❤ demo
lucas@www:~$ cat link.php
<?php

$str = trim(file_get_contents('results.txt'));

$arr = explode(PHP_EOL, $str);

foreach ($arr as $id) {
    echo ($id === 'id') ? '' : "https://www.thinktankforums.com/thread.php?thread_id=$id".PHP_EOL;
};

?>
lucas@www:~$ php link.php
 https://www.thinktankforums.com/thread.php?thread_id=20 
 https://www.thinktankforums.com/thread.php?thread_id=31 
 https://www.thinktankforums.com/thread.php?thread_id=156 
 https://www.thinktankforums.com/thread.php?thread_id=399 
 https://www.thinktankforums.com/thread.php?thread_id=622 
 https://www.thinktankforums.com/thread.php?thread_id=623 
 https://www.thinktankforums.com/thread.php?thread_id=624 
 https://www.thinktankforums.com/thread.php?thread_id=1965 
lucas@www:~$
lucas's avatar
13 years ago
link
lucas
i ❤ demo
i don't know where they went.
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
oh :)
lucas's avatar
13 years ago
link
lucas
i ❤ demo
maybe they were duplicates or tests or something weird. no idea
wumpwoast's avatar
12 years ago
link
wumpwoast
agony carbunkle
I know the post/thread totals are only calculated when a successful post/thread is added. Going into mysql and removing posts/threads doesn't reset the post/thread count.
lucas's avatar
12 years ago
r1, link
lucas
i ❤ demo
yeah, that's the best explanation.. they were probably manual deletions followed by a lack of considerate housekeeping