1

Topic: Problem viewing old topics after host change

Hi
Like the topic says I changed from old host to new one. I did take backup from the punbb db with the backup plugin.  After importing the data and modifying the config files to use right database everything looked fine.

However in the forum view it does show the topic name but it doesnt show reply/view/last post for that thread and when I try to view those threads it will display the following message.

Bad request. The link you followed is incorrect or outdated.

Making new thread(s) and displaying them works just fine.

Here's the debug information I get when I try to view topic

0.00067      SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=49
0.00052     UPDATE online SET logged=1182028507 WHERE user_id=49
0.00014     SELECT * FROM online WHERE logged<1182028207
0.00037     SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=49) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=1) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=449 AND t.moved_to IS NULL
0.00009     SELECT COUNT(id) FROM reports WHERE zapped IS NULL
0.00007     SELECT COUNT(id) FROM messages WHERE showed=0 AND owner=49
Total query time: 0.00186 s

I have no idea what's wrong so I came to seek help from here.

The server is running php 5.1.6 and mysql 5

2

Re: Problem viewing old topics after host change

Looks like getting backup again from the old host did the trick. Might as well close this topic yikes

Re: Problem viewing old topics after host change

I've seen this happen before when moved_to is set to 0 as opposed to NULL (just for anyone searching and turning up topics).

Re: Problem viewing old topics after host change

I am currently battling with this exact problem. Does anyone have the solution? My new db (after host change) does indeed show 0 instead of NULL.

Re: Problem viewing old topics after host change

Answering my own post:

A global change in viewtopic.php from " t.moved_to IS NULL " to " t.moved_to = 0 " solved the problem

Re: Problem viewing old topics after host change

Don't do that. Change the database properly instead.

alter table topics change moved_to moved_to int(10) unsigned default null

Re: Problem viewing old topics after host change

Thanks Smartys. Weirdly, the database property was exactly like that. But still the code didn't work. I found that I actually needed to test for both 0 and NULL because all new topics were being assigned the NULL. I even performed a manual update on all rows to FORCE the 0 to NULL but it still didn't work. I find that very bizarre. So now, I have code saying "where = 0 OR IS NULL" and now it all works. I don't like it, but I couldn't think of anything else to do!

Re: Problem viewing old topics after host change

Don't change the code. Is this the query you ran?:

update topics set moved_to=null where moved_to=0

Re: Problem viewing old topics after host change

I have the same problem and this is way over my head

if someone would be kind enough to help me out, I'd be forever in your debt!

Re: Problem viewing old topics after host change

well after much stress I figured it out. Turns out that when I ran install_mod it buggered something in the database up, I had to manually go into the database and add auto increment to quite a few of the tables.