XF 2.1 Oops - Cannot open a thread - link does not work but is in DB

Have any redirects in place? Something in .htacess? Try on a unmodified default style with all addons disabled?

What changes to the site happened before this issue arose?

There are no redirects, nothing in .htacess. I have removed .htacess with no help. I have tried the default style (using it currently) with all addons disabled.

There were no changes before this happened except for the import from VB 3.8.

The link has never worked since just after the import VB forum import.
 
I suspect you're running into a situation where we have a thread record but no posts. The comment in the code sums up our thoughts:

Code:
// should never really happen
return $this->error(\XF::phrase('something_went_wrong_please_try_again'));

Unless something went terribly wrong with the import or the DB was manually manipulated, this would indicate that there were no posts in these threads in the source DB. You would need to confirm that there. Note that any change here is likely to require a re-import and I don't know if you consider that viable (as it would likely require reinstalling XF).
 
Thanks all, been doing a lot of work on this and this is what I have done.

1) Created local xampp install of the forum from server (ftped from sever to local all community directory.)
2) Exported current db.
3) Imported db to local.
3) Ran query

SELECT * FROM xf_thread WHERE first_post_id = 0 AND last_post_id = 0 ORDER BY node_id DESC

4) Found 2331 threads matching.
5) Randomly checked 5 of 2331 posts by id in xf_post table and verified they DO NOT exist.
6) Checked same post id's in the vb post table an the 5 post ids DO exist.
7) Checked vb thread table for the 5 post id's and they are correct.

What I have done so far to test some theories.
1) Exported vb post, xf posts, vb threads and xf threads.
2) Read in all sql's as separate csv files.
3) Edited out all threads in xf_thread with first and last post id's so only id's with 0 are left.
4) Extracted thread id's from #3 and saved as csv.

So, big question, what will be the best way to rectify the situation?
 
Last edited:
Well, an update, a lot of work getting into this but I did some more work.
I'm not very familiar with PHP, Java or SQL. I'm not advanced but I get by. So, I resorted to my preferred languages that I have used for many years. Visual Basic, Fortran and C+.

I chose to write some code in VB mainly because I was just looking to do some quick text manipulation and VB can run undeclared variables as well as full variant variables (sloppy code but I wasn't ready to spend days on this.)

1) As in post #14 - item #3, extracted thread id's from SQL file of xf_thread but use criteria of A=0 first post id's, B=0 last post id's and C=0 first and last post id's.
2) Removed from the array any duplicate id's that satisfied multiple criteria of #1.
3) Deleted entries in xf_thread sql file that were saved from #2. (don't need this but already had data handy)
4) Parsed vb thread sql file and found all thread id's from #2.
5) Verified all had non 0 or null first and last post id's.
6) Extracted all vb thread rows that matched #4.
7) Created new sql file and put all vb thread rows from # into the new sql file.
8) Extracted all vb post rows that matched threadid from #4.
9) Created new sql file and put all vb post rows from #8 into the new sql file.

I think my next step is to:
1) Get the 2 sql file(s) setup for import (formatted correctly)
2) Remove xf_thread rows from db that match #4 (if needed.)
3) Remove xf_post rows from db that match #4 (i needed.)
4) Import 2 sql files for new thread and post tables but format for xf from vb.

I'm sure all this all could be done via php or just entering sql queries but I am not as versed in php and sql. I am going through pdf ebooks on sql commands right now to learn.

Also, I'm pretty sure on import the rows that need to read in can be deleted or over written but I'm still learning.

Is there any information available that explains what is needed in the sql file for import? I can copy what I have in the export files but unsure.

Any help with suggestions on a better way to do this is greatly appreciated.

Regards
 
Last edited:
I decided that now is a good time to become more familiar with sql and php.

Can this be accomplished by queries only or do I need to write a php code?

My biggest problem is not all threads just have one post, some have many including attachments. Can sql count and save each input row into an array? Is there a good recommendation or something online or reading?

I found this article and it seams to fit the bill. https://stackoverflow.com/questions/57998886/how-to-insert-multiple-rows-into-sql-using-an-array
 
Still have the original vb tables and I have manually used it to ix a few broken threads in xf. Just need to write something to do it automatically. The big hurdle I have now is adding the correct reply_count into the thread row.
 
Thanks, I have tried it but didn't help as the posts are completely missing from the xf_thread table but are in vb thread table. I just need to get them into the xf_post table (small changes) and fix the xf_thread table.

I'm making headway.

Thanks.
 
Back
Top Bottom