Resource icon

vB4 Importer 3.6b2

No permission to download

Adam Howard

Well-known member
#21
Most db servers don't allow remote access. But if your server does allow remote access then yes, you can import cross-server. But normally you would restore a backup of the database locally (on the same server as XF) and import from that.
Forgot to subscribe to this thread.......

While you could technically do a remote import; I've only known 2 sites who have done it successfully. I didn't exactly have that in mind when tweaking code. It can be done, but it also depends on how well the 2 servers communicate. Normally I've found such things time out (reasons for that vary host to host).

Of course if the 2 domains are on the same server; this is not a problem at all (it's still localhost)
 

ibaker

Well-known member
#22
Just tried this and everything worked great except for one error:
Code:
Server Error
 
Mysqli prepare error: Table 'xxxx_forum.helpfulanswer' doesn't exist
 
    Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 825
    Zend_Db_Adapter_Abstract->fetchOne() in XenForo/Importer/myvbulletin4.php at line 347
    XenForo_Importer_myvBulletin4->stepPostLikes() in XenForo/Importer/Abstract.php at line 77
    XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 180
    XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 232
    XenForo_ControllerAdmin_Import->_startStep() in XenForo/ControllerAdmin/Import.php at line 175
    XenForo_ControllerAdmin_Import->actionStartStep() in XenForo/FrontController.php at line 310
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /home/xxxx/public_html/xenforo/admin.php at line 13
The source vb forum doesn't have a helpfulanswer table, it does have the Post Thanks mod installed on it with a table called post_thanks but that is about it
 

Jake Bunce

XenForo moderator
Staff member
#23
Just tried this and everything worked great except for one error:
Code:
Server Error
 
Mysqli prepare error: Table 'xxxx_forum.helpfulanswer' doesn't exist
 
    Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 825
    Zend_Db_Adapter_Abstract->fetchOne() in XenForo/Importer/myvbulletin4.php at line 347
    XenForo_Importer_myvBulletin4->stepPostLikes() in XenForo/Importer/Abstract.php at line 77
    XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 180
    XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 232
    XenForo_ControllerAdmin_Import->_startStep() in XenForo/ControllerAdmin/Import.php at line 175
    XenForo_ControllerAdmin_Import->actionStartStep() in XenForo/FrontController.php at line 310
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /home/xxxx/public_html/xenforo/admin.php at line 13
The source vb forum doesn't have a helpfulanswer table, it does have the Post Thanks mod installed on it with a table called post_thanks but that is about it
If you don't have that table then you should skip that step.

Here is another option:

http://xenforo.com/community/threads/post-thank-you-hack-into-likes.23660/#post-291959
 

tenants

Well-known member
#24
Forgot to subscribe to this thread.......

While you could technically do a remote import; I've only known 2 sites who have done it successfully. I didn't exactly have that in mind when tweaking code. It can be done, but it also depends on how well the 2 servers communicate. Normally I've found such things time out (reasons for that vary host to host).

Of course if the 2 domains are on the same server; this is not a problem at all (it's still localhost)
They were on different servers, but a remote import was no problem, I just had to allow "Remote Database Access Hosts" for the 2 servers to communicate (this is available on most CPANELs that I've come across)

Worked without a hitch ;)
 

Cees50

Active member
#25
Today i tried to import an Vb database. I started the importer choose the vb4 option and then i must type in the name of the user en db. Then an prefix. I didnt have any prefix, so the importer stops. How can i pass that?
 

Jake Bunce

XenForo moderator
Staff member
#26
Today i tried to import an Vb database. I started the importer choose the vb4 option and then i must type in the name of the user en db. Then an prefix. I didnt have any prefix, so the importer stops. How can i pass that?
The prefix might be empty. You can confirm the prefix in vB's includes/config.php file.
 

Adam Howard

Well-known member
#27
If you there is no prefix, simply leave it blank. The importer will still work. I've imported my own site without a prefix, including dozens of others.
 

Adam Howard

Well-known member
#29
Guys I am in need of your assistance.

Is it okay for me to import directly from my site's live DB? I'm doing a mock run to test out things.
It maybe wise to backup your database first (and site) and then run a test first from that backup.

However, if you're not going to test this... Back up first anyways... Then run the import (remember both vBulletin and XenForo need to be closed for this to work).
 

Adam Howard

Well-known member
#30
Happy Holidays ---- On vacation ---- Limited access.

If you need help importing to XenForo, contact Jake Bunce. He maybe willing to help :)


edit: returned from Holiday vcation and able to help people once more convert to XenForo :)
 
Last edited:
V

vVv

Guest
#31
Yep. You can import into a forum that is already populated. Just be sure not to enable the import option to preserve the source ids.

I was wondering, is it possible to re-import again from vBulletin 4.2.0 to an already functioning XF forum, that was originally imported from the same vBulletin 4.2.0 forum? I mean, my current forum and content and members were imported to XF using this importer from vBulletin 4.2.0. But I had removed and renamed some sections after original import was completed, even removed some members as well. I wouldn't mind setting up current copy of the XF forums on localhost... and import into it from the original vBulletin 4.2.0.. without making too many duplicated imports.. Maybe in the vBulletin copy.. remove ALL sections, content, users .. that already exist in XF forum? To prevent too many possible duplicate imports of things? Or during import, select option to NOT keep ID's? Or what you think is best? I'd basically like to get back content and some users that I once had originally, but gotten rid of before.. Lol! Maybe I shouldn't have renamed sections, or dropped sections either.. >_<
 

Jake Bunce

XenForo moderator
Staff member
#32
I was wondering, is it possible to re-import again from vBulletin 4.2.0 to an already functioning XF forum, that was originally imported from the same vBulletin 4.2.0 forum? I mean, my current forum and content and members were imported to XF using this importer from vBulletin 4.2.0. But I had removed and renamed some sections after original import was completed, even removed some members as well. I wouldn't mind setting up current copy of the XF forums on localhost... and import into it from the original vBulletin 4.2.0.. without making too many duplicated imports.. Maybe in the vBulletin copy.. remove ALL sections, content, users .. that already exist in XF forum? To prevent too many possible duplicate imports of things? Or during import, select option to NOT keep ID's? Or what you think is best? I'd basically like to get back content and some users that I once had originally, but gotten rid of before.. Lol! Maybe I shouldn't have renamed sections, or dropped sections either.. >_<
Don't run the same import twice. There is no easy way to deal with the duplicate content from the first import.
 
V

vVv

Guest
#33
Don't run the same import twice. There is no easy way to deal with the duplicate content from the first import.
Well, it's been few months after the original initial import though, and ALOT was changed since the original import. Example; forums removed, new forums added, renamed, new members joined, material deleted from original forums from original import. What do you suggest? Maybe, install FRESH XF copy on localhost/ then FRESH old/original vbulletin 4.2.0 copy of site (that members/original content i want) and import into FRESH XF, without keeping the IDs or whatever, and close import session. Setup a second XF (fresh copy), restore the current (live site now) XF forum to it ... manually MOVE or COPY FROM "live site copy" to old original vB 4.2.0 copy of site that's in XF.. and whilst moving things, just ignore moving/copying over material that's already existing? And add posts/threads of users that currently exist, and post them as if they were doing it themselves with their accounts? Or, just install vB 4.2.0 copy on localhost fresh, copy hundreds/thousands of threads or posts manually to "live site" myself, posting the stuff as members themselves lol. Sorry, me confused and still not knowing best thing to do haha
 

Jake Bunce

XenForo moderator
Staff member
#34
As I said, there is no easy way to deal with duplicate content. This is necessary if you want to run the same import twice on the same installation of XF. If you can prune the duplicate content from the XF installation first, then you can run the import again and not have any duplicate content. Without built-in mass pruning utilities, it is going to be a pain to prune the duplicate content. Users should be automatically merged by email address, so it shouldn't be necessary to prune the users.
 
V

vVv

Guest
#35
As I said, there is no easy way to deal with duplicate content. This is necessary if you want to run the same import twice on the same installation of XF. If you can prune the duplicate content from the XF installation first, then you can run the import again and not have any duplicate content. Without built-in mass pruning utilities, it is going to be a pain to prune the duplicate content. Users should be automatically merged by email address, so it shouldn't be necessary to prune the users.
Ah, okay. Yeah, I didn't think users would be issue really, because most have same email address anyway, including myself. Same users, same emails, from first vB copy and then even in current XF live site. Basically, all I wanted from vB copy.. was users that might have been deleted before in live XF site, and the deleted content since original import. So in vBulletin, I could prune the "already imported content/possible dupe content/forums/etc".. just leaving what's been deleted before, for the import to XF "live site". I'll figure something out.. haha.
 
V

vVv

Guest
#38
would i like too though, is way to convert the "DBTech advance post likes/thanks" vbulletin plugin to XenForo "likes" or whatever.. lol. And sometimes, the DBTech plugin, gave users reputation points every time they got "thanks/likes" .. and for some reason.. the rep points/thanks/likes weren't imported properly.. :(
 

Jake Bunce

XenForo moderator
Staff member
#39
would i like too though, is way to convert the "DBTech advance post likes/thanks" vbulletin plugin to XenForo "likes" or whatever.. lol. And sometimes, the DBTech plugin, gave users reputation points every time they got "thanks/likes" .. and for some reason.. the rep points/thanks/likes weren't imported properly.. :(
I did an import recently that had a dbtech_thanks_entry table. I modified this step in the myvbulletin4.php file to import from that table. Copy/paste this step into that file, replacing the existing function of the same name:

Code:
    public function stepPostThanks($start, array $options)
    {
        $options = array_merge(array(
            'limit' => 200,
            'max' => false
        ), $options);

        $sDb = $this->_sourceDb;
        $prefix = $this->_prefix;

        /* @var $model PostThanksImporter_Model_Import */
        $model = $this->_importModel;
        
        if ($options['max'] === false)
        {
            $options['max'] = $sDb->fetchOne('
                SELECT MAX(entryid)
                FROM ' . $prefix . 'dbtech_thanks_entry
            ');
        }

        $postThanks = $sDb->fetchAll($sDb->limit(
            '
                SELECT pt.*, post.userid as content_userid
                FROM ' . $prefix . 'dbtech_thanks_entry AS pt
                LEFT JOIN ' . $prefix . 'post AS post ON (post.postid = pt.contentid)
                WHERE pt.entryid > ?
                ORDER BY pt.entryid
            ', $options['limit']
        ), $start);
        if (!$postThanks)
        {
            return true;
        }

        $next = 0;
        $total = 0;

        $userIds = array();
        $postIds = array();
        foreach ($postThanks AS $thanks)
        {
            $userIds[] = $thanks['userid'];
            $userIds[] = $thanks['content_userid'];
            $postIds[] = $thanks['contentid'];
        }
        $userIdMap = $model->getImportContentMap('user', $userIds);
        $postIdMap = $model->getImportContentMap('post', $postIds);
        XenForo_Db::beginTransaction();

        foreach ($postThanks AS $thanks)
        {
            $next = $thanks['entryid'];

            $likeUserId = $this->_mapLookUp($userIdMap, $thanks['userid']);
            $contentUserId = $this->_mapLookUp($userIdMap, $thanks['content_userid']);
            $postId = $this->_mapLookUp($postIdMap, $thanks['contentid']);
            if (!$likeUserId OR !$contentUserId OR !$postId)
            {
                continue;
            }
            
            $model->importPostThanks($postId, $contentUserId, $likeUserId, $thanks['dateline']);
            $total++;
        }


        XenForo_Db::commit();

        $this->_session->incrementStepImportTotal($total);
        
        // 1.0.0 Beta 2 introduces percentage progress format
        if (XenForo_Application::$versionId > 1000031)
        {
            return array($next, $options, $this->_getProgressOutput($next, $options['max']));
        }
        else 
        {
            return array($next, $options, "$next / $options[max]");
        }
    }
 
V

vVv

Guest
#40
I did an import recently that had a dbtech_thanks_entry table. I modified this step in the myvbulletin4.php file to import from that table. Copy/paste this step into that file, replacing the existing function of the same name:

Code:
    public function stepPostThanks($start, array $options)
    {
        $options = array_merge(array(
            'limit' => 200,
            'max' => false
        ), $options);
 
        $sDb = $this->_sourceDb;
        $prefix = $this->_prefix;
 
        /* @var $model PostThanksImporter_Model_Import */
        $model = $this->_importModel;
       
        if ($options['max'] === false)
        {
            $options['max'] = $sDb->fetchOne('
                SELECT MAX(entryid)
                FROM ' . $prefix . 'dbtech_thanks_entry
            ');
        }
 
        $postThanks = $sDb->fetchAll($sDb->limit(
            '
                SELECT pt.*, post.userid as content_userid
                FROM ' . $prefix . 'dbtech_thanks_entry AS pt
                LEFT JOIN ' . $prefix . 'post AS post ON (post.postid = pt.contentid)
                WHERE pt.entryid > ?
                ORDER BY pt.entryid
            ', $options['limit']
        ), $start);
        if (!$postThanks)
        {
            return true;
        }
 
        $next = 0;
        $total = 0;
 
        $userIds = array();
        $postIds = array();
        foreach ($postThanks AS $thanks)
        {
            $userIds[] = $thanks['userid'];
            $userIds[] = $thanks['content_userid'];
            $postIds[] = $thanks['contentid'];
        }
        $userIdMap = $model->getImportContentMap('user', $userIds);
        $postIdMap = $model->getImportContentMap('post', $postIds);
        XenForo_Db::beginTransaction();
 
        foreach ($postThanks AS $thanks)
        {
            $next = $thanks['entryid'];
 
            $likeUserId = $this->_mapLookUp($userIdMap, $thanks['userid']);
            $contentUserId = $this->_mapLookUp($userIdMap, $thanks['content_userid']);
            $postId = $this->_mapLookUp($postIdMap, $thanks['contentid']);
            if (!$likeUserId OR !$contentUserId OR !$postId)
            {
                continue;
            }
           
            $model->importPostThanks($postId, $contentUserId, $likeUserId, $thanks['dateline']);
            $total++;
        }
 
 
        XenForo_Db::commit();
 
        $this->_session->incrementStepImportTotal($total);
       
        // 1.0.0 Beta 2 introduces percentage progress format
        if (XenForo_Application::$versionId > 1000031)
        {
            return array($next, $options, $this->_getProgressOutput($next, $options['max']));
        }
        else
        {
            return array($next, $options, "$next / $options[max]");
        }
    }
NICE!! Thank you!! :D You're awesome!
 
Top