PDA

View Full Version : [fixed] Remove orphan threads not working? (no threadids?)


Stadler
Tue 19th Nov '02, 5:17pm
Maybe I'm wrong because I'm not familiar with JOINs, but it seems to me, that remove orphan threads can't work, because the query doesn't return any threadids.

I think $threads = $DB_site->query("SELECT thread.forumid FROM thread AS thread LEFT JOIN forum AS forum USING(forumid) WHERE forum.forumid IS NULL LIMIT $startat, $perpage");should be $threads = $DB_site->query("SELECT thread.threadid FROM thread AS thread LEFT JOIN forum AS forum USING(forumid) WHERE forum.forumid IS NULL LIMIT $startat, $perpage");

[PPN: Correct fix for this bug]

Scott MacVicar
Tue 19th Nov '02, 5:51pm
i'll check this it was a bit experimental when i was testing it.

yeah thread.forumid should just be thread.threadid

Stadler
Tue 19th Nov '02, 7:44pm
Umm ... btw: How about removing threads, which contain no posts at all, not even a starting post?

I think the query would be $threads = $DB_site->query("SELECT thread.threadid FROM thread AS thread LEFT JOIN post AS post USING(threadid) WHERE post.threadid IS NULL AND thread.open<>10 LIMIT $startat, $perpage");and adding this to CVS would be a matter of less than 5 mins :)

Scott MacVicar
Tue 19th Nov '02, 7:54pm
you would notice a thread with no posts as it would still appear in the appropriate forums.

At the moment its just a prune orphan threads and posts as these might not be removed when your removing a forum with lots of threads / posts.