<?php
$result = dbquery("SELECT COUNT(post_id) AS count, ".$db_prefix."posts.thread_id, ".$db_prefix."threads.thread_postcount
FROM ".$db_prefix."posts
JOIN ".$db_prefix."threads ON ".$db_prefix."threads.thread_id = ".$db_prefix."posts.thread_id
WHERE thread_postcount = 0
GROUP BY thread_id");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$result = dbquery("UPDATE ".$db_prefix."threads SET thread_postcount='".$data['count']."' WHERE thread_id='".$data['thread_id']."'");
}
}
$result = dbquery("SELECT SUM(thread_postcount) AS postcount, ".$db_prefix."threads.forum_id, ".$db_prefix."forums.forum_postcount
FROM ".$db_prefix."threads
JOIN ".$db_prefix."forums ON ".$db_prefix."forums.forum_id = ".$db_prefix."threads.forum_id
WHERE forum_postcount = 0
GROUP BY forum_id");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$result = dbquery("UPDATE ".$db_prefix."forums SET forum_postcount='".$data['postcount']."' WHERE forum_id='".$data['forum_id']."'");
}
}
$result = dbquery("SELECT COUNT(thread_id) AS threadcount, ".$db_prefix."threads.forum_id, ".$db_prefix."forums.forum_threadcount
FROM ".$db_prefix."threads
JOIN ".$db_prefix."forums ON ".$db_prefix."forums.forum_id = ".$db_prefix."threads.forum_id
WHERE forum_threadcount = 0
GROUP BY forum_id");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$result = dbquery("UPDATE ".$db_prefix."forums SET forum_threadcount='".$data['threadcount']."' WHERE forum_id='".$data['forum_id']."'");
}
}
$result = dbquery("SELECT MAX(post_id) AS lastpid, ".$db_prefix."posts.thread_id, ".$db_prefix."threads.thread_lastpostid
FROM ".$db_prefix."posts
JOIN ".$db_prefix."threads ON ".$db_prefix."threads.thread_id = ".$db_prefix."posts.thread_id
WHERE thread_lastpostid = 0
GROUP BY thread_id");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$result = dbquery("UPDATE ".$db_prefix."threads SET thread_lastpostid='".$data['lastpid']."' WHERE thread_id='".$data['thread_id']."'");
}
}
echo $result?"done":"not done<br>".mysql_error($result);
?>
<?php
$res = dbquery("SELECT COUNT(post_id) AS count, ".DB_POSTS.".thread_id, ".DB_THREADS.".thread_postcount
FROM ".DB_POSTS."
JOIN ".DB_THREADS." ON ".DB_THREADS.".thread_id = ".DB_POSTS.".thread_id
WHERE thread_postcount = 0
GROUP BY thread_id");
if(dbrows($res) > 0){
echo "Counting posts per thread <br/>\n";
while($data = dbarray($res)){
echo "...";
if(abs(microtime() - $start) < 20){
dbquery("UPDATE ".DB_THREADS." SET thread_postcount='".$data['count']."' WHERE thread_id='".$data['thread_id']."'");
}else{
header("Location: ".FUSION_SELF."?continue=1");
}
}
echo "done <br/>\n";
}
$res = dbquery("SELECT SUM(thread_postcount) AS postcount, ".DB_THREADS.".forum_id, ".DB_FORUMS.".forum_postcount
FROM ".DB_THREADS."
JOIN ".DB_FORUMS." ON ".DB_FORUMS.".forum_id = ".DB_THREADS.".forum_id
WHERE forum_postcount = 0
GROUP BY forum_id");
if(dbrows($res) > 0){
echo "Counting posts per forum <br/>\n";
while($data = dbarray($res)){
echo "...";
if(abs(microtime() - $start) < 20){
dbquery("UPDATE ".DB_FORUMS." SET forum_postcount='".$data['postcount']."' WHERE forum_id='".$data['forum_id']."'");
}else{
header("Location: ".FUSION_SELF."?continue=1");
}
}
echo "done <br/>\n";
}
$res = dbquery("SELECT COUNT(thread_id) AS threadcount, ".DB_THREADS.".forum_id, ".DB_FORUMS.".forum_threadcount
FROM ".DB_THREADS."
JOIN ".DB_FORUMS." ON ".DB_FORUMS.".forum_id = ".DB_THREADS.".forum_id
WHERE forum_threadcount = 0
GROUP BY forum_id");
if(dbrows($res) > 0){
echo "Counting threads per forum <br/>\n";
while($data = dbarray($res)){
echo "...";
if(abs(microtime() - $start) < 20){
dbquery("UPDATE ".DB_FORUMS." SET forum_threadcount='".$data['threadcount']."' WHERE forum_id='".$data['forum_id']."'");
}else{
header("Location: ".FUSION_SELF."?continue=1");
}
}
echo "done <br/>\n";
}
$res = dbquery("SELECT MAX(post_id) AS lastpid, ".DB_POSTS.".thread_id, ".DB_THREADS.".thread_lastpostid
FROM ".DB_POSTS."
JOIN ".DB_THREADS." ON ".DB_THREADS.".thread_id = ".DB_POSTS.".thread_id
WHERE thread_lastpostid = 0
GROUP BY thread_id");
if(dbrows($res) > 0){
echo "Calculating IDs of latest posts <br/>\n";
while($data = dbarray($res)){
echo "... ";
if(abs(microtime() - $start) < 20){
dbquery("UPDATE ".DB_THREADS." SET thread_lastpostid='".$data['lastpid']."' WHERE thread_id='".$data['thread_id']."'");
}else{
header("Location: ".FUSION_SELF."?continue=1");
}
}
echo "done <br/>\n";
}
echo "Ok";
?>
Notice: Undefined variable: start in /home2/dbests/public_html/administration/custom_pages.php(88) : eval()'d code on line 12
Quote
dewa5227 wrote:
digi i got this x_x when i preview that in custom page, but it still working well 0_0Code Download sourceNotice: Undefined variable: start in /home2/dbests/public_html/administration/custom_pages.php(88) : eval()'d code on line 12
Quote
stranded wrote:
Clicking threads with -1 fixes them eventually, just open a thread and it shows the right number after that. Doesn't really bother me that much.
Quote
it's not count of reads, but count of posts :)
Category Forum
Suspected Bugs and Errors - 8Labels
None yet
Statistics
6 participants
Notifications
You are not receiving notifications from this thread.
Related Questions