Fixed vb4->xF202 Import error

JonUrban

Member
I decided to start from scratch on a local test install, with the end result being upgrading my "real" vB4 forum to XF (in the upcoming weeks).

I created a local environment, backed up my live vB (4.2.5) forum and installed the backup and database on my test MAMP setup. I then installed a clean xF202 and backed up the empty database. Then ran the importer. It made it through the users, posts, and attachments, which is farther than it did the first time I tried this. But then I got the following error. Is this something I can fix, or is it an issue with the importer being a "beta". If it's the latter, maybe this will help you in the debug.

My vB test database name is vB425 and the test xF db is xF202.

XenForo
XF\Db\Exception: MySQL statement prepare error [1146]: Table 'vb425.blog_attachment' doesn't exist in src\XF\Db\AbstractStatement.php at line 212

XF\Db\AbstractStatement->getException() in src\XF\Db\Mysqli\Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src\XF\Db\Mysqli\Statement.php at line 39
XF\Db\Mysqli\Statement->prepare() in src\XF\Db\Mysqli\Statement.php at line 54
XF\Db\Mysqli\Statement->execute() in src\XF\Db\AbstractAdapter.php at line 79
XF\Db\AbstractAdapter->query() in src\XF\Db\AbstractAdapter.php at line 91
XF\Db\AbstractAdapter->fetchOne() in src\XF\Import\Importer\vBulletinBlogTrait.php at line 392
XF\Import\Importer\vBulletin4WithBlog->getStepEndBlogAttachments() in src\XF\Import\Runner.php at line 126
XF\Import\Runner->setupRunnableStep() in src\XF\Import\Runner.php at line 57
XF\Import\Runner->run() in src\XF\Admin\Controller\Import.php at line 232
XF\Admin\Controller\Import->actionRun() in src\XF\Mvc\Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1889
XF\App->run() in src\XF.php at line 328
XF::runApp() in admin.php at line 13
 

Kier

XenForo developer
Staff member
Just to confirm, your vB4 does in fact have the blog product installed?
 

Kier

XenForo developer
Staff member
Did you ever have vB3 installed, or did you start with vB4?
 

Kier

XenForo developer
Staff member
What I think has happened is that the importer assumes that all tables that exist following an upgrade from vB3 to vB4 will exist in an installation that starts with vB4 - but it would appear that the blog_attachment table created by vB3 does not exist when the installation started with vB4.

I'll have to write a workaround to handle that. In the meantime, you can avoid the error by simply deselecting the vB3/legacy blog attachments step when you select the steps you want to run.
 

Kier

XenForo developer
Staff member
I have a fix committed for this, but I need to fully test it later.
 

JonUrban

Member
Kier. YES, it was a vB3 forum, upgraded to vB4 way back when.

I don't remember having a chance to select which steps I wanted to run, as in the older importer. This time I just got a single line with an info-type box telling me what was running.

Will I have to restore the blank vF db and restart the import or is there a way to just bypass this step and continue. Right now I have left everything as is.
 

Kier

XenForo developer
Staff member
Kier. YES, it was a vB3 forum, upgraded to vB4 way back when.

I don't remember having a chance to select which steps I wanted to run, as in the older importer. This time I just got a single line with an info-type box telling me what was running.

Will I have to restore the blank vF db and restart the import or is there a way to just bypass this step and continue. Right now I have left everything as is.
As you've already started the import, you'll need to edit the scripts in order to bypass the steps. It's quite simple:

Both edits need to happen in src/XF/Import/Importer/vBulletinBlogTrait.php

Edit 1: Find this:
public function getStepEndBlogAttachments()
and right after the opening {, add this: return 0;

Edit 2: Find this:
public function stepBlogAttachments(StepState $state, array $stepConfig, $maxTime, $limit = 1000)
and right after the opening {, add this: return $state->complete();

Then you should be able to start the import running again and it will just bypass the step.

On a separate note, would you mind opening a support ticket including details to allow me to look at your vB database? I'm curious as to how your DB managed to not have the blog_attachment table.
 

JonUrban

Member
Kier,

In between responses, I installed xF1.5 and imported into that without issues, although I don't think it included Blogs, and for some reason the xF forum cannot find the attachments (no big deal)

After I read your response above, I made the modifications as noted above (was I supposed to delete the remained of the functions?), but when I attempted to restart the import, it never got past that error, so I blew that 2.0.2 install away and recreated a new install and database. This time I looked for and unchecked the selections for blog attachments (legacy data) and blog attachments (vB4 data) and it is running now.

Sure, you can check out my vB database. I will create the ticket and address it to you referencing this thread.
 

JonUrban

Member
Well, the vB2.0.2 import worked flawlessly, even the attachments came through. Now I can play around with the local forum and get used to the software. Thanks Kier for your help
 

Astra

Member
Blogs moved, it's great! Attachments were not transferred, i.e. no photos. I'm looking forward to the next update, I hope it will be final, because apart from these two minor amendments - everything else works fine!
Sorry for my English.

P.S.
After the transfer of blogs: Photo from the Blog, there is in the Database (visible in the attachments in the Administrator panel), there is also a title of the photo at the beginning of the blog, but when you click, an error occurs.
Conclusion: photos from blogs were transferred, but lost a bunch with a new page?
 
Last edited:
Top